#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> bl(N + 1, 0), wh(N + 1, 0), ans(N + 1, 0);
  bool ch1, ch2 = false;
  for (int i = 1; i <= N - 1; i++) {
    bl[i] = bl[i - 1];
    if (S[i - 1] == '#') {
      bl[i]++;
      ch1 = true;
    }
    wh[N - i] = wh[N - i + 1];
    if (S[N - i] == '.') {
      wh[N - i]++;
      ch2 = true;
    }
  }
  for (int i = 0; i <= N; i++) ans[i] = bl[i] + wh[i];
  sort((ans).begin(), (ans).end());
  if (ch1 && ch2)
    cout << ans[2] << endl;
  else
    cout << 0 << endl;
  return 0;
}
