#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, koko;
  int count = 0, ans;
  string S;
  cin >> N >> S;
  ans = N;
  vector<int> siro(N);
  vector<int> kuro(N);
  for (int i = N - 1; i >= 0; i--) {
    if (S.at(i) == '.') {
      count = count + 1;
      siro.at(i) = count;
    } else {
      siro.at(i) = count;
    }
  }
  count = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '#') {
      count = count + 1;
      kuro.at(i) = count;
      ans = min(ans, siro.at(i) + kuro.at(i) - 1);
    } else {
      kuro.at(i) = count;
    }
  }
  if (count == 1) {
    cout << 1 << endl;
  } else if (count == 0) {
    cout << 0 << endl;
  } else {
    cout << ans << endl;
  }
}
