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() {
  long long n, ans1 = 0, ans2, x, y, i, j;
  cin >> n;
  string s, ts;
  cin >> s;
  ts = s;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (i = 0; i < s.size(); i += 2) {
    if (i == n - 1 && s[i] == 'r') {
      ans1++;
      continue;
    }
    if (!(s[i] == 'b' && s[i + 1] == 'r')) {
      if (s[i] == 'r' && s[i + 1] == 'b') {
        ans1++;
      } else if (s[i] == 'r' && s[i + 1] == 'r') {
        ans1++;
      } else if (s[i] == 'b' && s[i + 1] == 'b') {
        if (s[i + 2] == 'r')
          s[i + 2] = 'b', ans1++;
        else
          ans1++;
      }
    }
  }
  s = ts;
  ans2 = ans1;
  ans1 = 0;
  for (i = 0; i < s.size(); i += 2) {
    if (i == n - 1 && s[i] == 'b') {
      ans1++;
      continue;
    }
    if (!(s[i] == 'r' && s[i + 1] == 'b')) {
      if (s[i] == 'b' && s[i + 1] == 'r') {
        ans1++;
      } else if (s[i] == 'b' && s[i + 1] == 'b') {
        ans1++;
      } else if (s[i] == 'r' && s[i + 1] == 'r') {
        if (s[i + 2] == 'b')
          s[i + 2] = 'r', ans1++;
        else
          ans1++;
      }
    }
  }
  cout << min(ans1, ans2);
  return 0;
}
