#include <bits/stdc++.h>
using namespace std;
int n;
string s;
const int OO = (int)1e9;
int mem[1001][3];
bool editable(int i, int prev) {
  if (i == 0) return true;
  if (i == n - 1) {
    if (s[n - 2] == s[n - 1] || s[n - 1] - '0' == prev) return true;
    return false;
  }
  if (s[i] == s[i + 1] || s[i] - '0' == prev || s[i] == s[i - 1]) return true;
  return false;
}
int recurse(int i = 0, int prev = 0) {
  if (i == n) return 0;
  int &ret = mem[i][prev];
  if (ret != -1) return ret;
  int c1 = OO;
  if (i == 0)
    c1 = recurse(i + 1, s[i] - '0');
  else {
    if (s[i] - '0' != prev) c1 = recurse(i + 1, s[i] - '0');
  }
  int c2 = OO;
  if (i == 0) {
    if (editable(i, prev)) c2 = recurse(i + 1, !(s[i] - '0')) + 1;
  } else {
    if (editable(i, prev) && s[i] - '0' == prev)
      c2 = recurse(i + 1, !(s[i] - '0')) + 1;
  }
  return (ret = min(c1, c2));
}
int main() {
  while (cin >> n >> s) {
    memset(mem, -1, sizeof(mem));
    int res = recurse();
    if (res == OO)
      cout << "-1\n";
    else
      cout << res << "\n";
  }
  return 0;
}
