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 long long INF = 1e9 + 7;
vector<pair<long long, long long> > v;
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  v.resize(n);
  string s;
  cin >> s;
  if (s[0] == 'r') {
    v[0] = make_pair(0, 1);
  } else {
    v[0] = make_pair(1, 0);
  }
  for (int i = 1; i < n; ++i) {
    v[i] = make_pair(INF, INF);
  }
  for (int i = 1; i < n; ++i) {
    if (s[i] == 'r') {
      v[i].first = min(v[i - 1].second, v[i].first);
      v[i].second = min(v[i - 1].first + 1, v[i].second);
      if (i > 1 && s[i] != s[i - 1]) {
        v[i].second = min(v[i].second, v[i - 2].second + 1);
      }
    } else {
      v[i].first = min(v[i - 1].second + 1, v[i].first);
      v[i].second = min(v[i - 1].first, v[i].second);
      if (i > 1 && s[i] != s[i - 1]) {
        v[i].first = min(v[i].first, v[i - 2].first + 1);
      }
    }
  }
  cout << min(v[n - 1].first, v[n - 1].second);
  return 0;
}
