#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  string S;
  string K = "#";
  string T = ".";
  cin >> N >> S;
  int scount = 0, tcount = 0;
  int AllSC[21000], AllTC[21000];
  for (int i = 0; i < N; i++) {
    if (S[i] == K[0]) {
      scount++;
    } else {
      tcount++;
    }
    AllTC[i] = tcount;
    AllSC[i] = scount;
  }
  int mini = N, needs = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == K[0] and S[i + 1] == T[0]) {
      needs = AllSC[i] + (AllTC[N - 1] - AllTC[i]);
      if (AllTC[i] == 0 && AllSC[N - 1] - AllSC[i] == 0) {
        int needsc = needs - AllSC[i];
        int needtc = needs - AllTC[N - 1] - AllTC[i];
        needs = min(needsc, needtc);
      } else if (AllSC[N - 1] - AllSC[i] == 0) {
        needs -= AllTC[N - 1] - AllTC[i];
      } else if (AllTC[i] == 0) {
        needs -= AllSC[i];
      }
      if (mini > needs) {
        mini = needs;
      }
    }
  }
  if (mini == N) mini = 0;
  cout << mini << endl;
  return 0;
}
