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;
void file() {
  freopen("input.in", "r", stdin);
  freopen("output.out", "w", stdout);
}
int n, a[200001], kolc, kolb, ans, ans1, ans2, ans3, kolc1, kolb1, k1, k2;
string s;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] == 'r') {
      a[i] = 1;
    }
  }
  for (int i = 2; i <= n; ++i) {
    if (a[i] == a[i - 1] && a[i] == 1) {
      kolc++;
    } else if (a[i] == a[i - 1]) {
      kolb++;
    }
  }
  ans1 = (kolc + 1) / 2 + (kolb + 1) / 2;
  k1 = (kolc + 1) / 2;
  k2 = (kolb + 1) / 2;
  ans += min(k1, k2);
  if (kolc + 1 < ans * 2) ans--;
  if (kolb + 1 < ans * 2) ans--;
  kolc -= ans * 2;
  kolb -= ans * 2;
  cout << min((kolc + 1) / 2 + (kolb + 1) / 2 + ans, ans1);
  return 0;
  ans3 += (kolb + 1) / 2;
  ans3 += (kolc + 1) / 2;
  kolc1 = kolc;
  kolb1 = kolb;
  ans1 = ans;
  if (kolc) {
    if (a[1] == 0) {
      kolc--;
      ans1++;
    }
  }
  if (kolc) {
    if (a[n] == 0) {
      kolc--;
      ans1++;
    }
  }
  if (kolb) {
    if (a[1] == 1) {
      kolb--;
      ans1++;
    }
  }
  if (kolb) {
    if (a[n] == 1) {
      kolb--;
      ans1++;
    }
  }
  ans1 += (kolb + 1) / 2;
  ans1 += (kolc + 1) / 2;
  ans2 = ans;
  kolc = kolc1;
  kolb = kolb1;
  ans2 += (kolb + 1) / 2;
  ans2 += (kolc + 1) / 2;
  cout << min(min(ans1, ans2), ans3);
}
