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() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string str;
  cin >> str;
  char curr = 'r';
  string comparer;
  string comparer2;
  for (int i = 0; i != n; ++i) {
    comparer += curr;
    (curr == 'r') ? curr = 'b' : curr = 'r';
    comparer2 += curr;
  }
  unordered_map<string, int> count;
  for (int i = 0; i != n; ++i) {
    if (str[i] != comparer[i]) {
      string diff;
      diff += str[i];
      diff += comparer[i];
      count[diff]++;
    }
  }
  int ans = min(count["rb"], count["br"]) + abs(count["rb"] - count["br"]);
  count = unordered_map<string, int>();
  for (int i = 0; i != n; ++i) {
    if (str[i] != comparer2[i]) {
      string diff;
      diff += str[i];
      diff += comparer2[i];
      count[diff]++;
    }
  }
  ans =
      min(ans, min(count["rb"], count["br"]) + abs(count["rb"] - count["br"]));
  cout << ans << endl;
}
