#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long count = 0;
  long long f = -1;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '#') {
      count++;
      if (f < 0) {
        f = i;
      }
    }
  }
  reverse(s.begin(), s.end());
  long long ans = (n - f - count) % (n + 1);
  count = 0;
  f = -1;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '.') {
      count++;
      if (f < 0) {
        f = i;
      }
    }
  }
  ans = min(ans, (n - f - count) % (n + 1));
  cout << ans << endl;
}
