#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  int horyu = 0;
  string S;
  string K = "#";
  string T = ".";
  cin >> N >> S;
  int scount = 0, tcount = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == K[0]) {
      if (S[i + 1] != T[0]) {
        horyu++;
      } else {
        scount += horyu;
        scount++;
        horyu = 0;
      }
    } else {
      if (scount > 0) {
        tcount++;
      }
    }
  }
  if (tcount >= scount) {
    cout << scount << endl;
  } else {
    cout << tcount << endl;
  }
  return 0;
}
