#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S, SS;
  cin >> N >> S;
  SS = S;
  long long num_b = 0, num_w = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '#')
      num_b++;
    else
      num_w++;
  }
  bool frag = false;
  long long first_black = N;
  for (long long i = 0; i < N; i++) {
    if (frag == false && S.at(i) == '#') {
      first_black = i;
      break;
    }
  }
  if (num_b > num_w)
    cout << num_w - first_black << endl;
  else {
    if (first_black == N) {
      cout << 0 << endl;
      return 0;
    }
    if (S.at(N - 1) == '#')
      cout << num_b - 1 << endl;
    else
      cout << num_b << endl;
  }
}
