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 r = 0, b = 0, ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    r += (c[i] == 'r');
    b += (c[i] == 'b');
  }
  if (n == 1) {
    cout << 0;
  } else if (b == n) {
    cout << n / 2;
  } else if (r == n) {
    cout << n / 2;
  } else {
    char last = '.';
    for (int i = 1; i <= n; i++) {
      if (last == '.') {
        last = c[i];
      } else {
        if (last == 'b') {
          if (c[i] == 'r') {
            last = c[i];
            continue;
          } else if (c[i] == 'b') {
            if (c[i + 1] == 'r' && i + 1 <= n) {
              swap(c[i], c[i + 1]);
              last = 'r';
              ans++;
            } else if (c[i + 1] == 'b' && i + 1 <= n) {
              c[i] = 'r';
              ans++;
              last = 'r';
            } else if (i + 1 > n)
              c[i] = 'r', ans++;
          }
        } else if (last == 'r') {
          if (c[i] == 'b') {
            last = c[i];
            continue;
          } else if (c[i] == 'r') {
            if (c[i + 1] == 'b' && i + 1 <= n) {
              ans++;
              swap(c[i + 1], c[i]);
              last = 'b';
            } else if (c[i + 1] == 'r' && i + 1 <= n) {
              c[i] = 'b';
              ans++;
              last = 'b';
            } else if (i + 1 > n)
              c[i] = 'b', ans++;
          }
        }
      }
    }
    cout << ans;
  }
  return 0;
}
