#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  vector<int> a;
  char flag = S[0];
  int count;
  for (int i = 0; i < N; i++) {
    count = 0;
    while (S[i] == flag) {
      i++;
      count++;
    }
    a.push_back(count);
    flag = S[i];
    i--;
  }
  int ans = 0;
  if (S[0] == '#') {
    for (int i = 0; i < a.size(); i += 2) {
      ans += min(a[i], a[i + 1]);
    }
  } else {
    for (int i = 1; i < a.size(); i += 2) {
      ans += min(a[i], a[i + 1]);
    }
  }
  cout << ans << endl;
  return 0;
}
