#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  ll white_count = 0;
  ll black_count = 0;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '#') {
      ++black_count;
    } else {
      ++white_count;
    }
  }
  ll bl = 0;
  ll wr = white_count;
  ll ans = white_count + black_count;
  for (int i = 0; i < N; ++i) {
    if (S[i] == '#') {
      ++bl;
    } else {
      --wr;
    }
    ans = min(ans, bl + wr);
  }
  cout << ans << endl;
  return 0;
}
