#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cw = 0;
  int cb = 0;
  int64_t ans = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '#') {
      if (cw > 0) {
        ans += min(cb, cw);
        cb = 0;
        cw = 0;
      }
      cb++;
    } else {
      if (cb > 0) {
        cw++;
      }
    }
  }
  ans += min(cb, cw);
  cout << ans << endl;
  return 0;
}
