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;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
template <typename T, typename U>
static void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
int main(int argc, char const *argv[]) {
  int n;
  string str;
  cin >> n;
  cin >> str;
  string cmp;
  char ch[] = {'r', 'b'};
  for (int(i) = 0; (i) < (int)(n); ++(i)) cmp.push_back(ch[i & 1]);
  int res = 0;
  stack<char> stk;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    if (str[i] != cmp[i]) {
      if (stk.empty()) {
        stk.push(str[i]);
      } else {
        if (stk.top() != str[i])
          stk.pop(), res++;
        else
          stk.push(str[i]);
      }
    }
  }
  res += stk.size();
  while (stk.size()) stk.pop();
  cmp.clear();
  for (int(i) = 0; (i) < (int)(n); ++(i)) cmp.push_back(ch[(i + 1) & 1]);
  int res2 = 0;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    if (str[i] != cmp[i]) {
      if (stk.empty()) {
        stk.push(str[i]);
      } else {
        if (stk.top() != str[i])
          stk.pop(), res2++;
        else
          stk.push(str[i]);
      }
    }
  }
  res2 += stk.size();
  cout << min(res, res2);
  return 0;
}
