#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N >> S;
  vector<int> vec;
  int count = 0;
  char prev = '#';
  int i = 0;
  for (; i < S.size(); ++i) {
    if (vec.empty() && S[i] == '#') {
      count++;
      prev = S[i];
      break;
    }
  }
  for (; i < S.size(); ++i) {
    if (prev == S[i]) {
      count++;
    } else {
      vec.push_back(count);
      prev = S[i];
      count = 1;
    }
    if (i == S.size() - 1) {
      vec.push_back(count);
    }
  }
  int res = 0;
  for (int i = 0; i < vec.size(); i += 2) {
    res += min(vec[i], vec[i + 1]);
  }
  cout << res << '\n';
  return 0;
}
