#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string bin;
  while (cin >> n && (n != 0)) {
    cin >> bin;
    string p, b;
    int con = 0;
    for (int x = 0; x < bin.size(); x++) {
      if (x < bin.size() && con < bin.size()) {
        p += '1';
        b += '0';
        con++;
      }
      if (x < bin.size() && con < bin.size()) {
        p += '0';
        b += '1';
        con++;
      }
    }
    int conig_p = 0, conig_b = 0;
    for (int x = 0; x < bin.size(); x++) {
      if (bin[x] == p[x]) conig_p++;
      if (bin[x] == b[x]) conig_b++;
    }
    cout << min(conig_p, conig_b) << endl;
  }
  return 0;
}
