#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      cnt++;
    }
  }
  if (cnt == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (s[n - 1] == '#' && cnt >= n - cnt) {
    int ecnt = 0;
    for (int i = n; i > 0; i--) {
      if (s[i - 1] == '#') {
        ecnt++;
      } else {
        if (cnt >= n) {
          cout << cnt - n - ecnt << endl;
        } else {
          cout << n - cnt - ecnt << endl;
        }
        return 0;
      }
    }
  }
  if (cnt >= n) {
    cout << cnt - n << endl;
  } else {
    cout << n - cnt << endl;
  }
  return 0;
}
