#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 233;
int n, m;
int cnt[maxn], p[maxn];
char s[maxn];
int main() {
  cin >> n;
  cin >> s + 1;
  int c = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '#') {
      c++;
    } else {
      cnt[c]++;
    }
  }
  p[c + 1] = 0;
  for (int i = c; i >= 1; i--) p[i] += p[i + 1] + cnt[i];
  int ans = p[1];
  for (int i = 1; i <= c; i++) {
    ans = min(ans, i + p[i + 1]);
  }
  cout << ans << endl;
  return 0;
}
