#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  char str[N + 1];
  cin >> str;
  vector<int> v;
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (str[i] == str[i + 1]) {
      count++;
    } else {
      if (count != 0) v.push_back(count + 1);
      if (count == 0) v.push_back(1);
      count = 0;
    }
  }
  v.push_back(count);
  int count1 = 0;
  int count2 = 0;
  for (int i = 0; i < v.size() - 2; i++) {
    if (i % 2 == 0) {
      count1 += v[i];
    }
    if (i % 2 == 1) {
      count2 += v[i];
    }
  }
  int ans = min(count1, count2);
  cout << ans;
  return 0;
}
