#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e16;
signed main() {
  lint N;
  cin >> N;
  string s;
  cin >> s;
  vector<lint> black(N + 1, 0);
  for (lint i = 0; i < N; i++) black[i + 1] = black[i] + (s[i] == '#');
  lint sum = black[N];
  lint ans = INF;
  for (lint i = 0; i < N; i++) {
    if (s[i] == '#') {
      lint ans1 = black[i] + (N - i) - (sum - black[i]);
      ans = min(ans, ans1);
    }
  }
  if (ans == INF)
    cout << 0 << endl;
  else
    cout << ans << endl;
}
