#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  string S;
  cin >> S;
  int now = 0;
  long long int count = 0;
  long count_white = 0;
  long count_black = 0;
  int rg_black = 0;
  int rg_white = 0;
  for (long i = 0; i < S.size(); i++) {
    char stone_now = S[i];
    if (stone_now == '.' and now == 1) {
      count_white++;
    } else if (stone_now == '#') {
      if (now == 0) {
        now = 1;
      }
      if (now == 1) count_black++;
    }
    if (i == S.size() - 1) {
      rg_black += count_black;
      rg_white += count_white;
      count += min(count_black, count_white);
      count_black = 0;
      count_white = 0;
    }
  }
  cout << count << endl;
}
