#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  string S;
  cin >> S;
  long long ans = 0;
  long long CB = 0, CW = 0;
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    if (S[i] == '#') {
      if (i > 0 && S[i - 1] == '.') {
        ans += min(CB, CW);
        CB = 0;
        CW = 0;
      }
      CB++;
    } else {
      CW++;
    }
  }
  ans += min(CB, CW);
  cout << ans << endl;
}
