#include <bits/stdc++.h>
long long mod = 1e9 + 7;
using namespace std;
int main() {
  int n;
  cin >> n;
  char c, lastc;
  map<char, int> cnt;
  cnt['.'] = 0;
  cnt['#'] = 0;
  lastc = '.';
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> c;
    if (c == lastc) {
      cnt[c]++;
    } else if (c == '#') {
      ans += min(cnt['.'], cnt['#']);
      cnt['.'] = 0;
      cnt['#'] = 1;
    } else {
      cnt['.'] = 1;
    }
    lastc = c;
  }
  if (c == '.') {
    ans += min(cnt['.'], cnt['#']);
  }
  cout << ans << endl;
  return 0;
}
