#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long A, B = 0, C = 0, N, K = 0;
  string S, W, T;
  cin >> N >> S;
  for (long long i = 0; i < N; i++) {
    if (S.at(i) == '#') {
      if (B == 0) A = N - i;
      B += 1;
    }
  }
  for (long long i = 0; i < N; i++) {
    if (S.at(N - i - 1) == '.') {
      if (C == 0) C = N - 1;
      K += 1;
      cout << C << K << endl;
    }
  }
  if (C - K < A - B)
    cout << C - K << endl;
  else
    cout << A - B << endl;
}
