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>
int Set(int N, int pos) { return N = N | (1 << pos); }
int reSet(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
using namespace std;
int n;
int dp[100007][3][3], a[100007];
string str;
int go(int cur, int pre, int m) {
  if (cur >= n) {
    if (m == 2)
      return 0;
    else
      return 1 << 30;
  }
  if (dp[cur][pre][m] != -1) return dp[cur][pre][m];
  int ret = 1 << 30;
  if (m != 2) {
    if (1 - a[cur] == m)
      ;
    ret = min(ret, 1 + go(cur + 1, m, 2));
  } else if (pre == 0) {
    if (a[cur] == 0) {
      ret = min(ret, go(cur + 1, 0, 0));
      ret = min(ret, 1 + go(cur + 1, 1, 2));
    } else {
      ret = min(ret, go(cur + 1, 1, 2));
      ret = min(ret, 1 + go(cur + 1, pre, 2));
    }
  } else if (pre == 1) {
    if (a[cur] == 1) {
      ret = min(ret, 1 + go(cur + 1, 0, 2));
      ret = min(ret, go(cur + 1, 1, 1));
    } else {
      ret = min(ret, go(cur + 1, 0, 2));
      ret = min(ret, 1 + go(cur + 1, pre, 2));
    }
  }
  return dp[cur][pre][m] = ret;
}
int main() {
  while (cin >> n) {
    cin >> str;
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == 'r')
        a[i] = 0;
      else
        a[i] = 1;
    }
    memset(dp, -1, sizeof dp);
    int ret = go(1, a[0], 2);
    memset(dp, -1, sizeof dp);
    ret = min(ret, 1 + go(1, 1 - a[0], 2));
    printf("%d\n", ret);
  }
  return 0;
}
