166
rbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrbbbrbbbbbbbbbbbbbbrbrbbbbbbbbbbbrbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbb
 7
rrbrbrb
 1
r
 2
bb
 18
rrrrrrrrrrrrrrrrrb
 8
rbbrbrbr
 1
b
 13
rbbbrbrrbrrbb
 100
brbbbrrrbbrbrbbrbbrbbbbrbbrrbbbrrbbbbrbrbbbbbbbbbbbbbbbbrrrrbbbbrrrbbbbbbbrbrrbrbbbbrrrbbbbrbbrbbbrb
 2
rb
 2
rr
 2
br

70
 1
 0
 1
 8
 1
 0
 3
 34
 0
 1
 0

#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
string s;
int n, ans, curans;
bool done[N], c[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == 'b')
      c[i] = true;
    else
      c[i] = false;
  for (int i = 0; i < s.size(); i++) {
    if (done[i]) continue;
    if ((i % 2 == 0 && c[i]) || (i % 2 == 1 && !c[i])) {
      done[i] = true;
      continue;
    }
    if (i > 0) {
      if (c[i - 1] != c[i] && !done[i - 1]) {
        ans++;
        done[i] = true;
        done[i - 1] = true;
        continue;
      }
    }
    if (i < n - 1) {
      if (c[i + 1] != c[i]) {
        ans++;
        done[i] = true;
        done[i + 1] = true;
        continue;
      }
    }
    ans++;
    done[i] = true;
  }
  for (int i = 0; i < n; i++) done[i] = false;
  for (int i = 0; i < n; i++) {
    if (done[i]) continue;
    if ((i % 2 == 1 && c[i]) || (i % 2 == 0 && !c[i])) {
      done[i] = true;
      continue;
    }
    if (i > 0) {
      if (c[i - 1] != c[i] && !done[i - 1]) {
        curans++;
        done[i] = true;
        done[i - 1] = true;
        continue;
      }
    }
    if (i < n - 1) {
      if (c[i + 1] != c[i]) {
        curans++;
        done[i] = true;
        done[i + 1] = true;
        continue;
      }
    }
    curans++;
    done[i] = true;
  }
  ans = min(ans, curans);
  cout << ans;
  return 0;
}
