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;
const int inf = (int)(1e9) + 100;
const int mod = (int)(1e9) + 100;
const int N = (int)(2e5) + 100;
int n;
char c[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  int r = 0, b = 0;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    r += (c[i] == 'r');
    b += (c[i] == 'b');
  }
  if (r == n || b == n)
    cout << n / 2;
  else {
    if (r == b) {
      bool ok = 1;
      char last = '.';
      for (int i = 1; i <= n; i++) {
        if (last != c[i])
          last = c[i];
        else
          ok = 0;
      }
      if (ok)
        cout << 0;
      else {
        cout << (r + 1) / 2;
      }
    } else {
      bool ok = 1;
      char last = '.';
      for (int i = 1; i <= n; i++) {
        if (last != c[i])
          last = c[i];
        else
          ok = 0;
      }
      if (ok)
        cout << 0;
      else
        cout << max(r, b) / 2;
    }
  }
  return 0;
}
