#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, mode, B, C, x, xx, D, E, F;
  cin >> N;
  A = N;
  B = N;
  C = N;
  D = 0;
  E = N;
  char S;
  while (cin >> S) {
    if (mode == 0) {
      if (S == '#') {
        mode++;
      }
    } else {
      if (mode == 1 & S == '.' & A == N) {
        A = 1;
      } else if (S == '.') {
        A++;
        D = 0;
        F = 1;
      } else if (S == '#') {
        if (D == 0 && F == 1) {
          D++;
        }
        D++;
      }
    }
    if (S == '#') {
      B--;
    } else if (S = '.') {
      C--;
    }
  }
  E = C - D;
  x = min(A, E);
  xx = min(x, B);
  cout << xx << endl;
}
