#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  cin >> N >> S;
  long long res = 1000000;
  vector<long long> ba(N), wa(N);
  int b = 0, w = -1;
  int i = 0, j = N - 1;
  while (i < N) {
    if (S.at(j) == '.') {
      w++;
    }
    if (S.at(i) == '#') {
      b++;
    }
    wa.at(j) = w;
    ba.at(i) = b;
    i++;
    j--;
  }
  for (int i = 0; i < N; i++) {
    if (i != N - 1 && S.at(i) != S.at(i + 1)) {
      res = min(res, (wa.at(i) + ba.at(i)));
    }
  }
  if (res == 1000000) {
    cout << 0 << endl;
  } else {
    cout << res << endl;
  }
}
