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() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int fin = n + 1;
  string ss = s + ']';
  for (size_t i = 0; i != n; ++i) {
    if (i % 2 == 0) {
      if (ss[i] == 'r' && ss[i + 1] == 'b') {
        ++ans;
        swap(ss[i], ss[i + 1]);
      } else if (ss[i] != 'b') {
        ++ans;
        ss[i] = 'b';
      }
    } else {
      if (ss[i] == 'b' && ss[i + 1] == 'r') {
        ++ans;
        swap(ss[i], ss[i + 1]);
      } else if (ss[i] == 'b') {
        ++ans;
        ss[i] = 'r';
      }
    }
  }
  fin = min(ans, fin);
  ans = 0;
  ss = s + ']';
  for (size_t i = 0; i != n; ++i) {
    if (i % 2 == 0) {
      if (ss[i] == 'b' && ss[i + 1] == 'r') {
        ++ans;
        swap(ss[i], ss[i + 1]);
      } else if (ss[i] != 'r') {
        ++ans;
        ss[i] = 'r';
      }
    } else {
      if (ss[i] == 'r' && ss[i + 1] == 'b') {
        ++ans;
        swap(ss[i], ss[i + 1]);
      } else if (ss[i] == 'r') {
        ++ans;
        ss[i] = 'b';
      }
    }
  }
  fin = min(fin, ans);
  ans = 0;
  ss = '{' + s;
  int it = 0;
  for (size_t i = n + 1; i != 1; --i) {
    if (it % 2 == 0) {
      if (ss[i] == 'b' && ss[i - 1] == 'r') {
        ++ans;
        swap(ss[i], ss[i - 1]);
      } else if (ss[i] == 'b') {
        ++ans;
        ss[i] = 'r';
      }
    } else {
      if (ss[i] == 'r' && ss[i - 1] == 'b') {
        ++ans;
        swap(ss[i], ss[i - 1]);
      } else if (ss[i] == 'r') {
        ++ans;
        ss[i] = 'b';
      }
    }
    ++it;
  }
  fin = min(ans, fin);
  ans = 0;
  ss = '{' + s;
  it = 0;
  for (size_t i = n + 1; i != 1; --i) {
    if (it % 2 == 1) {
      if (ss[i] == 'b' && ss[i - 1] == 'r') {
        ++ans;
        swap(ss[i], ss[i - 1]);
      } else if (ss[i] == 'b') {
        ++ans;
        ss[i] = 'r';
      }
    } else {
      if (ss[i] == 'r' && ss[i - 1] == 'b') {
        ++ans;
        swap(ss[i], ss[i - 1]);
      } else if (ss[i] == 'r') {
        ++ans;
        ss[i] = 'b';
      }
    }
    ++it;
  }
  cout << min(fin, ans) << endl;
  return 0;
}
