#include <bits/stdc++.h>
using namespace std;
int N;
string S;
vector<int> T;
int main(int argc, char *argv[]) {
  cin >> N >> S;
  T = vector<int>(N);
  int cnt_w = 0, cnt_b = 0, min_cnt = 0;
  for (int i = 0; i < N; ++i) {
    char s = S.at(i);
    if (s == '#') {
      if (cnt_w != 0) {
        min_cnt += min(cnt_b, cnt_w);
        cnt_b = 0;
        cnt_w = 0;
      }
      cnt_b++;
    }
    if (s == '.') {
      cnt_w++;
    }
  }
  min_cnt += min(cnt_b, cnt_w);
  cout << min_cnt << endl;
  return 0;
}
