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 sz;
vector<bool> colors;
int DP[(int)1e5 + 5][3][3];
int solve(int index, int prev, int pre_previous) {
  if (prev != -1 && pre_previous != -1 && prev == pre_previous &&
      colors[index] == prev) {
    return DP[index][prev + 1][pre_previous + 1] = 1e7;
  }
  if (index == sz) {
    return DP[index][prev + 1][pre_previous + 1] = 0;
  }
  if (DP[index][prev + 1][pre_previous + 1] != -1) {
    return DP[index][prev + 1][pre_previous + 1];
  }
  int leave = 1e7, swp = 1e7, change = 1e7;
  leave = solve(index + 1, colors[index], prev);
  swp = solve(index + 1, prev, colors[index]) + 1;
  change = solve(index + 1, !colors[index], prev) + 1;
  return DP[index][prev + 1][pre_previous + 1] = min(leave, min(swp, change));
}
int main() {
  memset(DP, -1, sizeof(DP));
  cin >> sz;
  colors.resize(sz);
  for (int i = 0; i < sz; i++) {
    char t;
    cin >> t;
    colors[i] = (t == 'b');
  }
  cout << solve(0, -1, -1) << endl;
  return 0;
}
