#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, sumb = 1, sumw = 1, summb = 0, summw = 0;
  cin >> N;
  char S[N];
  int black[N], white[N];
  scanf("%s", S);
  int jb = 0, jw = 0;
  for (int i = 0; i < N - 1; i++) {
    if (S[i] == '.') {
      if (S[i] == S[i + 1]) {
        sumw++;
        if (i == N - 2) {
          white[jw] = sumw;
          summw += sumw;
          jw++;
        }
      } else {
        white[jw] = sumw;
        summw += sumw;
        sumw = 1;
        jw++;
        if (i == N - 2) {
          black[jb] = 1;
          summb += 1;
          jb++;
        }
      }
    } else {
      if (S[i] == S[i + 1]) {
        sumb++;
        if (i == N - 2) {
          black[jb] = sumb;
          summb += sumb;
          jb++;
        }
      } else {
        black[jb] = sumb;
        summb += sumb;
        sumb = 1;
        jb++;
        if (i == N - 2) {
          white[jw] = 1;
          summw += 1;
          jw++;
        }
      }
    }
  }
  int mint = 20000;
  int k = 0, l = 0, a = 0;
  if (S[0] == '#') {
    l += black[0];
    a++;
  }
  for (int i = 0; i < jw; i++) {
    k += white[i];
    if (mint > (l + summw - k)) mint = l + summw - k;
    l += black[a];
    a++;
  }
  if (S[0] == '.') {
    summw -= white[0];
  }
  if (S[N - 1] == '#') {
    summb -= black[jb - 1];
  }
  int b = min(summw, summb);
  cout << min(mint, b) << endl;
  return 0;
}
