#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> cnt(N + 1);
  int w = 0;
  cnt[0] = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      w++;
    }
  }
  for (int i = 0; i < N; i++) {
    cnt[i + 1] = cnt[i];
    if (S[i] == '#') {
      cnt[i + 1]++;
    }
  }
  int ans = 2147483647;
  for (int i = 1; i < N; i++) {
    ans = min(ans, cnt[i] + N - (w - cnt[i] + i - cnt[i]));
  }
  cout << ans - 1 << endl;
  getchar();
  getchar();
  return 0;
}
