#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = 1001001001;
const long long INFL = (1LL << 60);
const double eps = (1e-9);
long long mod = 1000000007;
int count_ab(const string& s) {
  int count = 0;
  string find_word("AB");
  auto pos = s.find(find_word);
  while (pos != string::npos) {
    count++;
    pos = s.find(find_word, pos + find_word.size());
  }
  return count;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int n_black = 0;
  int n_white = 0;
  int count = 0;
  for (auto itr = s.rbegin(); itr != s.rend(); itr++) {
    if (*itr == '.') {
      n_white++;
      count++;
    }
    if (*itr == '#') {
      n_black++;
      ans += count;
      count = 0;
    }
  }
  chmin(ans, n_white);
  chmin(ans, n_black);
  int ans2 = 0;
  char prev = '#';
  for (auto itr = s.rbegin(); itr != s.rend(); itr++) {
    if (*itr == '.') prev = '.';
    if (*itr == '#' && prev == '.') ans2++;
  }
  chmin(ans, ans2);
  cout << ans << endl;
  return 0;
}
