#include <bits/stdc++.h>
using namespace std;
long long MOD = (long long)1e9 + 7;
long long INF = (long long)2e18;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  string S;
  cin >> N >> S;
  long long blackCoordinate = -1;
  for (long long i = N - 1; i >= 0; i--) {
    if (S[i] == '#') {
      blackCoordinate = i;
      break;
    }
  }
  if (blackCoordinate == -1) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 1e9;
  long long black = 0, white = 0;
  for (long long i = 0; i < blackCoordinate; i++) {
    if (S[i] == '#') ++black;
  }
  for (long long i = blackCoordinate + 1; i < N; i++) {
    if (S[i] == '.') ++white;
  }
  ans = black + white;
  for (long long i = blackCoordinate - 1; i >= 0; i--) {
    if (S[i] == '.')
      ++white;
    else if (S[i] == '#') {
      --black;
      ans = min(ans, black + white);
    }
  }
  cout << ans << endl;
}
