#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 2e6 + 5;
int n, dp[MAX][3];
string s;
int solve(int i, int p) {
  if (i == n) return 0;
  if (dp[i][p] != -1) return dp[i][p];
  int ret = 1e9;
  if (p == 0) {
    if (s[i] - '0' == 0)
      ret = 1 + solve(i + 1, 1);
    else
      ret = solve(i + 1, 1);
  } else if (p == 1) {
    if (s[i] - '0' == 1)
      ret = 1 + solve(i + 1, 0);
    else
      ret = solve(i + 1, 0);
  } else {
    ret = min(solve(i + 1, s[i] - '0'), 1 + solve(i + 1, (1 - (s[i] - '0'))));
  }
  return dp[i][p] = ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  memset(dp, -1, sizeof dp);
  cout << solve(0, 2);
}
