#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int n;
string in;
int solve(string to) {
  string s = in;
  int ret = 0;
  int cnt = n;
  while (cnt--) {
    for (int i = (cnt % 2 ? 0 : n - 2); cnt % 2 ? (i < n - 1) : (i >= 0);
         (cnt % 2 ? i++ : i--)) {
      if (s[i] == s[i + 1]) {
        ret++;
        s[i] = to[i];
        s[i + 1] = to[i + 1];
      }
    }
    if (s == to) {
      return ret;
    }
  }
  return INT_MAX;
}
int main() {
  cin >> n >> in;
  string a, b;
  for (int i = 0; i < n; i++) {
    a += char('0' + i % 2);
    b += char('1' - i % 2);
  }
  int ans = min(solve(a), solve(b));
  if (ans == INT_MAX)
    cout << "-1\n";
  else
    cout << ans << "\n";
}
