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>
const int MAXN = 100005;
int n;
char s[MAXN];
int B = 0, R = 0;
int main() {
  while (scanf("%d", &n) != EOF) {
    scanf("%s", s);
    int res = 0;
    B = 0, R = 0;
    char pre;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        pre = s[0];
        continue;
      }
      if (s[i] != pre) {
        pre = s[i];
        continue;
      }
      if (s[i] == 'r') {
        if (R == 0) {
          res++;
          pre = 'b';
          B++;
        } else {
          pre = 'b';
          R--;
        }
      } else {
        if (B == 0) {
          res++;
          pre = 'r';
          R++;
        } else {
          pre = 'r';
          B--;
        }
      }
    }
    int ans = res;
    res = 0;
    B = 0, R = 0;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        if (s[0] == 'b') {
          pre = 'r';
          R++;
          res++;
        } else {
          pre = 'b';
          B++;
          res++;
        }
        continue;
      }
      if (s[i] != pre) {
        pre = s[i];
        continue;
      }
      if (s[i] == 'r') {
        if (R == 0) {
          res++;
          pre = 'b';
          B++;
        } else {
          pre = 'b';
          R--;
        }
      } else {
        if (B == 0) {
          res++;
          pre = 'r';
          R++;
        } else {
          pre = 'r';
          B--;
        }
      }
    }
    printf("%d\n", res < ans ? res : ans);
  }
}
