#include <bits/stdc++.h>
using namespace std;
char dif = 'A' - 'a';
int mod = 1e9 + 7;
long long inf = 1e18;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int sum = 0;
  vector<int> a(n + 1);
  a[0] = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      sum++;
      a[i + 1] += sum;
    } else
      a[i + 1] = a[i];
  }
  int mi = mod;
  for (int i = 0; i < n; i++) {
    if (a[n] - a[i + 1] > 0) mi = min(mi, a[n] - a[i]);
  }
  if (a[n] == 0)
    cout << 0 << endl;
  else
    cout << mi << endl;
  return 0;
}
