#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 1;
const long long inf = 1e9;
string s;
long long n, a[N], dp[N][N][2][2];
long long func(long long l, long long r, long long cl, long long cr) {
  if (l == 1 && r == n) return 0;
  long long &ans = dp[l][r][cl][cr];
  if (ans != -1) return ans;
  ans = inf;
  if (l > 1) ans = min(ans, (a[l - 1] == cl) + func(l - 1, r, 1 ^ cl, cr));
  if (r < n) ans = min(ans, (a[r + 1] == cr) + func(l, r + 1, cl, 1 ^ cr));
  if (l > 1 && r < n)
    ans = min(ans, (a[r + 1] == cr) + (a[l - 1] == cl) +
                       func(l - 1, r + 1, 1 ^ cl, 1 ^ cr));
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n;
  cin >> s;
  for (long long i = 1; i <= n; i++) a[i] = s[i - 1] - '0';
  long long ans = inf;
  for (long long i = 1; i <= n; i++) {
    ans = min(ans, func(i, i, a[i], a[i]));
    ans = min(ans, 1 + func(i, i, 1 ^ a[i], 1 ^ a[i]));
  }
  cout << ans;
  return 0;
}
