#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using UINT = unsigned long long;
unsigned gcd(unsigned a, unsigned b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
int main() {
  UINT N;
  string s;
  cin >> N >> s;
  char c = '.';
  vector<UINT> a;
  a.push_back(0);
  for (size_t i = 0; i < s.length(); i++) {
    if (s[i] == c) {
      (a.back())++;
    } else {
      a.push_back(1);
    }
    c = s[i];
  }
  UINT wh = 0, bl = 0;
  if (a.size() % 2 == 0) {
    a.pop_back();
  }
  if (a.size() <= 2) {
    cout << 0 << endl;
    return 0;
  }
  UINT ans = 0;
  for (size_t i = 1; i < a.size(); i += 2) {
    ans += min(a[i], a[i + 1]);
  }
  cout << ans << endl;
  return 0;
}
