#include <bits/stdc++.h>
using namespace std;
char toggleNow(char s) { return s == '#' ? '.' : '#'; }
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> v;
  char now = '#';
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (now == s[i]) {
      cnt++;
    } else {
      v.push_back(cnt);
      now = toggleNow(now);
      cnt = 1;
    }
  }
  if (cnt != 0) {
    v.push_back(cnt);
  }
  if (v.size() % 2 != 0) {
    v.push_back(0);
  }
  int ans = 0;
  for (int i = 1; i < v.size(); i += 2) {
    if (v[0] == 0 && i == 1) {
      continue;
    }
    ans += v[i];
  }
  cout << ans;
  return 0;
}
