#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long cnt = 0;
  long long mn = 1 << 30;
  long long kuro = 0;
  long long siro = 0;
  vector<long long> sirocnt(n);
  long long kuromax = 0;
  long long index = n;
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '#')
      kuro++;
    else
      siro++;
    sirocnt[i] = siro;
    if (kuromax < kuro - siro) {
      kuromax = kuro - siro;
      index = i;
    }
  }
  if (index == n) {
    puts("0");
    return 0;
  }
  long long ans = sirocnt[index];
  for (long long i = 0; i < (index); i++) {
    if (s[i] == '#') ans++;
  }
  cout << ans << endl;
}
