#include <bits/stdc++.h>
using namespace std;
long long INF = 1e9 + 7;
long long mod = 100000;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
signed main() {
  long long N;
  string S;
  cin >> N >> S;
  vector<pair<long long, long long> > sum(N + 1);
  long long A = 0, B = 0;
  for (long long i = 0; i < N; i++) {
    if (S[i] == '#') {
      A++;
      sum[i + 1].first = sum[i].first + 1;
      sum[i + 1].second = sum[i].second;
    } else {
      B++;
      sum[i + 1].second = sum[i].second + 1;
      sum[i + 1].first = sum[i].first;
    }
  }
  if (A == N || B == N) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = INF;
  for (long long i = 0; i < N; i++) {
    long long cnt = sum[i + 1].first;
    cnt += (B - sum[i].second);
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}
