#include <bits/stdc++.h>   using namespace std;   const int INF = 0x7f7f7f7f;   char s[1005];   int dp[1005][2];   int main() {     int n;     scanf( %d , &n);     scanf( %s , s);     if (1 == n) {       puts( 0 );       return 0;     }     memset(dp, 0x7f, sizeof(dp));     dp[0][s[0] -  0 ] = 0;     dp[0][(s[0] -  0 ) ^ 1] = 1;     for (int i = 1; i < n; ++i) {       if (s[i] ==  1 ) {         dp[i][1] = dp[i - 1][0];         dp[i][0] = dp[i - 1][1] + 1;       } else {         dp[i][0] = dp[i - 1][1];         dp[i][1] = dp[i - 1][0] + 1;       }     }     int ans = min(dp[n - 1][0], dp[n - 1][1]);     if (ans >= INF) ans = -1;     printf( %d n , ans);     return 0;   }   