#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  int prev_black_sum = 0;
  int now_white_sum = 0;
  int tmp_white_sum = 0;
  bool now_white;
  if (S.at(0) == '.') {
    now_white = true;
  } else {
    now_white = false;
  }
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == '#' && now_white) {
      if (prev_black_sum - tmp_white_sum > now_white_sum) {
        ans += now_white_sum;
        tmp_white_sum += now_white_sum;
        now_white_sum = 0;
        cout << "change to black";
      } else {
        ans = ans - tmp_white_sum - tmp_white_sum + prev_black_sum;
        prev_black_sum = 0;
        now_white_sum = 0;
        tmp_white_sum = 0;
        cout << "change to white";
      }
    }
    if (S.at(i) == '#') {
      prev_black_sum++;
      now_white = false;
    }
    if (S.at(i) == '.') {
      now_white_sum++;
      now_white = true;
    }
  }
  if (S.at(N - 1) == '.') {
    if (prev_black_sum - tmp_white_sum > now_white_sum) {
      ans += now_white_sum;
      tmp_white_sum += now_white_sum;
      now_white_sum = 0;
    } else {
      ans = ans - tmp_white_sum - tmp_white_sum + prev_black_sum;
      prev_black_sum = 0;
      now_white_sum = 0;
      tmp_white_sum = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
