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