#include <bits/stdc++.h>
using namespace std;
int n;
string a;
int dp[1001][2];
char FlipBit(char bit) {
  if (bit == '0') return '1';
  return '0';
}
int NumOnesInXor(string a1, string a2) {
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a1[i] != a2[i]) count++;
  }
  return count;
}
int MinMoves2() {
  string potentialAns1 = "";
  string potentialAns2 = "";
  char curr1 = '0';
  char curr2 = '1';
  for (int i = 0; i < n; i++) {
    potentialAns1 += curr1;
    potentialAns2 += curr2;
    curr1 = FlipBit(curr1);
    curr2 = FlipBit(curr2);
  }
  return min(NumOnesInXor(a, potentialAns1), NumOnesInXor(a, potentialAns2));
}
int MinMoves(int curr, int prevNum) {
  if (curr == n) return 0;
  if (curr + 1 == n) {
    if (a[curr] - '0' == prevNum) return 0;
    return 1;
  }
  if (dp[curr][prevNum] != -1) return dp[curr][prevNum];
  int ans;
  int movesToAdd = 0;
  if (curr == 0) {
    if (a[curr] == a[curr + 1]) {
      ans = min(MinMoves(curr + 2, 0) + 1, MinMoves(curr + 2, 1) + 1);
    } else {
      int oppCurrNum = 0;
      if (a[curr] == '0') oppCurrNum = 1;
      ans = min(MinMoves(curr + 2, a[curr] - '0'),
                MinMoves(curr + 2, oppCurrNum) + 1);
    }
  } else {
    if (a[curr] == a[curr + 1]) {
      return MinMoves(curr + 2, prevNum) + 1;
    } else {
      if (a[curr] - '0' != prevNum) movesToAdd = 1;
      return MinMoves(curr + 2, prevNum) + movesToAdd;
    }
  }
  dp[curr][prevNum] = ans;
  return ans;
}
int main() {
  cin >> n;
  cin >> a;
  for (int i = 0; i < n; i++) {
    dp[i][0] = -1;
    dp[i][1] = -1;
  }
  cout << MinMoves2();
}
