#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;
  int B = 0, W = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      if (W != 0) {
        if (W < B) {
          B += W;
          count += W;
        } else {
          count += B;
          W = 0;
          B = 0;
        }
      }
      B++;
    } else if (S[i] == '.') {
      W++;
    }
  }
  count += min(B, W);
  cout << count << endl;
}
