#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int dp[n][n][2];
  for (int len = 1; len <= n; len++) {
    for (int i = 0, j = i + len - 1; j < n; i++, j++) {
      if (len == 1) {
        dp[i][j][0] = (s[j] != '0');
        dp[i][j][1] = (s[j] != '1');
      } else {
        dp[i][j][0] = (s[j] != '0') + dp[i][j - 1][1];
        dp[i][j][1] = (s[j] != '1') + dp[i][j - 1][0];
      }
    }
  }
  cout << min(dp[0][n - 1][0], dp[0][n - 1][1]) << endl;
}
