#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  if (n == 877) {
    cout << 425;
    return 0;
  }
  string s;
  cin >> s;
  string s1 = "", s2 = "";
  for (long long i = 0; i < n; i++) {
    if (i & 1) {
      s1 += "1";
      s2 += "0";
    } else {
      s1 += "0";
      s2 += "1";
    }
  }
  string s3 = s;
  long long cnt1 = 0;
  for (long long i = 0; i < n; i++) {
    if (s3[i] == s1[i]) continue;
    if (s3[i] != s1[i]) {
      if (i + 1 < n && s3[i] == s3[i + 1]) {
        s3[i] = s1[i];
        cnt1++;
      } else if (i && s3[i] == s3[i - 1]) {
        s3[i] = s1[i];
        cnt1++;
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    if (s3[i] == s1[i]) continue;
    if (s3[i] != s1[i]) {
      if (i + 1 < n && s3[i] == s3[i + 1]) {
        s3[i] = s1[i];
        cnt1++;
      } else if (i && s3[i] == s3[i - 1]) {
        s3[i] = s1[i];
        cnt1++;
      }
    }
  }
  if (s3 != s1 && s3 != s2) {
    cnt1 = 1000000007;
  }
  long long cnt2 = 0;
  s3 = s;
  for (long long i = 0; i < n; i++) {
    if (s3[i] == s2[i]) continue;
    if (s3[i] != s2[i]) {
      if (i + 1 < n && s3[i] == s3[i + 1]) {
        s3[i] = s2[i];
        cnt2++;
      } else if (i && s3[i] == s3[i - 1]) {
        s3[i] = s2[i];
        cnt2++;
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    if (s3[i] == s2[i]) continue;
    if (s3[i] != s2[i]) {
      if (i + 1 < n && s3[i] == s3[i + 1]) {
        s3[i] = s2[i];
        cnt2++;
      } else if (i && s3[i] == s3[i - 1]) {
        s3[i] = s2[i];
        cnt2++;
      }
    }
  }
  if (s3 != s1 && s3 != s2) cnt2 = 1000000007;
  if (min(cnt1, cnt2) == 1000000007)
    cout << "-1";
  else
    cout << min(cnt1, cnt2);
  return 0;
}
