#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  static int N, Bcount[200010] = {}, Wcount[200010] = {}, ans = 100000000;
  cin >> N >> S;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#')
      Bcount[i + 1] = Bcount[i] + 1, Wcount[i + 1] = Wcount[i];
    else
      Bcount[i + 1] = Bcount[i], Wcount[i + 1] = Wcount[i] + 1;
  }
  for (int i = 1; i <= N; i++) {
    if (S[i - 1] == '#') {
      int X = Bcount[i] - 1 + Wcount[N] - Wcount[i];
      ans = min(ans, X);
    }
  }
  if (ans == 100000000) ans = 0;
  cout << ans;
}
