#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  string S;
  cin >> N >> S;
  int white = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') white++;
  }
  int long long = -1, lr = -1, len = 0;
  for (int i = 0; i < N; i++) {
    int _ll = -1, _lr = -1;
    if (S[i] == '#') {
      _ll = i;
      int k = i;
      while (S[k] == '#' && k < N) k++;
      _lr = k;
    }
    if (len < _lr - _ll + 1) {
      long long = _ll;
      lr = _lr;
      len = (lr - long long);
    }
  }
  int count = 0;
  for (int k = lr; k < N; k++)
    if (S[k] == '.') count++;
  for (int i = 0; i < long long; i++)
    if (S[i] == '#') count++;
  cout << min(count, min(white, (int)(N)-white)) << endl;
}
