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