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, count = 0, ans;
  cin >> n;
  string s;
  cin >> s;
  long long r = 0, b = 0;
  for (long long i = 0; i < n; i++)
    if (s[i] == 'r')
      r++;
    else if (s[i] == 'b')
      b++;
  for (long long i = 0; i < n; i++)
    if (i % 2 == 0 && s[i] != 'r')
      count++;
    else if (i % 2 == 1 && s[i] != 'b')
      count++;
  long long rx = n % 2 == 1 ? 1 + (long long)(n / 2) : n / 2;
  ans = abs(r - rx);
  count -= ans;
  ans += (count / 2);
  count = 0;
  for (long long i = 0; i < n; i++)
    if (i % 2 == 1 && s[i] != 'r')
      count++;
    else if (i % 2 == 0 && s[i] != 'b')
      count++;
  ans = min(ans, abs(b - rx) + (count - abs(b - rx)) / 2);
  cout << ans;
}
