#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  string s;
  cin >> n >> s;
  long bl = 0;
  long wh = 0;
  int ans = 0;
  long blmax = 0;
  bool black = false;
  for (int i = 0; i < n; i++) {
    if (s.substr(i, 1) == "#") {
      black = true;
      bl += 1;
    } else if (black) {
      if (bl > blmax) {
        blmax = bl;
      }
      bl -= 1;
      if (bl < 0) {
        ans += blmax;
        bl = 0;
        blmax = 0;
      }
    }
  }
  ans += blmax - bl;
  cout << ans << endl;
}
