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