#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5;
int n;
char a[maxN];
int ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[i] -= '0';
  }
  for (int i = 1; i < n; ++i) {
    if (a[i] == a[i - 1]) {
      a[i] ^= 1;
      ++ans;
    }
  }
  cout << min(ans, n - ans);
  return 0;
}
