#include <bits/stdc++.h>
const int MAXN = 1e6 + 10;
const double eps = 1e-8;
const int inf = 1e9 + 7;
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int dp[MAXN][2], n;
char str[MAXN];
int main() {
  dp[0][0] = dp[0][1] = 0;
  n = read();
  scanf("%s", str + 1);
  int x = str[1] - '0';
  for (int i = 1; i <= n; i++) {
    dp[i][0] = dp[i][1] = inf;
    x = str[i] - '0';
    dp[i][x] = min(dp[i][x], dp[i - 1][x ^ 1]);
    dp[i][x ^ 1] = min(dp[i][x ^ 1], dp[i - 1][x] + 1);
  }
  printf("%d\n", min(dp[n][0], dp[n][1]));
  return 0;
}
