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;
int main(void) {
  int n;
  cin >> n;
  string s, s0;
  cin >> s0;
  s = s0;
  int cnt1 = 0, cnt2 = 0;
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] != 'r')
      cnt1++;
    else if (!(i & 1) && s[i - 1] != 'b')
      cnt2++;
  }
  int res1 = max(cnt1, cnt2), cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] == 'b') {
      s[i - 1] = 'r';
      cnt++;
    } else if (!(i & 1) && s[i - 1] == 'r') {
      s[i - 1] = 'b';
      cnt++;
    }
    if (cnt == 2 * res1) break;
  }
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] != 'r')
      res1++;
    else if (!(i & 1) && s[i - 1] != 'b')
      res1++;
  }
  cnt1 = 0, cnt2 = 0;
  s = s0;
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] != 'b')
      cnt1++;
    else if (!(i & 1) && s[i - 1] != 'r')
      cnt2++;
  }
  int res2 = max(cnt1, cnt2);
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] == 'r') {
      s[i - 1] = 'r';
      cnt++;
    } else if (!(i & 1) && s[i - 1] == 'b') {
      s[i - 1] = 'r';
      cnt++;
    }
    if (cnt == 2 * res1) break;
  }
  for (int i = 1; i <= n; i++) {
    if (i & 1 && s[i - 1] != 'b')
      res2++;
    else if (!(i & 1) && s[i - 1] != 'r')
      res2++;
  }
  cout << min(res1, res2);
}
