#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int total = 0;
  int tmp = 0;
  int now = 0;
  int b_num = 0;
  int w_num = 0;
  int do_flg = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      do_flg = 1;
      if (now != 0) {
        now = 0;
        total += min(b_num, w_num);
        w_num = 0;
      }
      b_num++;
    } else {
      if (do_flg != 1) continue;
      now = 1;
      w_num++;
    }
  }
  if (w_num != 0) total += min(b_num, w_num);
  cout << total << endl;
  return 0;
}
