#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int cntb = 0;
  int cntw = 0;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      if (i != 0 && s[i - 1] == '.') {
        v.push_back({cntb, cntw});
        cntb = 1;
        cntw = 0;
      } else {
        cntb++;
      }
    } else {
      cntw++;
    }
  }
  v.push_back({cntb, cntw});
  int ans = 0;
  for (auto bw : v) {
    ans += min(bw.first, bw.second);
  }
  cout << ans << endl;
  return 0;
}
