#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, ans;
  string S;
  cin >> N >> S;
  for (ans = 0; ans < N; ans++) {
    if (S[N - ans - 1] == '.') break;
  }
  N -= ans;
  long long c = 0;
  for (long long i = 0; i < N; i++) {
    if (S[i] == '.') c++;
  }
  long long c1, c2 = 0;
  bool flag = true;
  char ask = '#';
  for (c2 = 0; c2 < N; c2++) {
    if (S[N - 1 - c2] == ask) {
      if (ask == '#') {
        if (flag == true) {
          c1 = c2;
          flag = false;
          ask = '.';
        } else {
          c1 = N;
          break;
        }
      } else {
        ask = '#';
      }
    }
  }
  cout << min(min(c, N - c), c1) << endl;
  return 0;
}
