#include <bits/stdc++.h>
using namespace std;
const long long INF64 = (long long)1e16;
const int INF = 1e9 + 500;
const int mod = (int)1e9 + 7;
long long cp(pair<int, int> o, pair<int, int> a, pair<int, int> b) {
  return (long long)(a.first - o.first) * (long long)(b.second - o.second) -
         (long long)(b.first - o.first) * (long long)(a.second - o.second);
}
void test_case() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> arr(n);
  int ans = INF;
  for (int rep = 0; rep < 2; rep++) {
    for (int i = 0; i < n; i++) {
      arr[i] = s[i] - '0';
    }
    int cnt = 0, curr = rep;
    for (int i = 0; i < n; i++) {
      if (arr[i] != curr) {
        cnt += 1;
        if (i + 1 < n && arr[i + 1] == arr[i]) {
          arr[i + 1] = curr ^ 1;
        }
      }
      curr = curr ^ 1;
    }
    ans = min(ans, cnt);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) test_case();
}
