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 main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int pr = 0, pb = 0;
  int cnt = 0;
  for (int x = 1; x < n; ++x) {
    pr = max(x + 1, pr), pb = max(x + 1, pb);
    if (s[x] == s[x - 1]) {
      string t;
      int p;
      if (s[x] == 'r')
        t = "bb", p = pb;
      else
        t = "rr", p = pr;
      bool done = false;
      for (int i = p; i < n; ++i) {
        if (i + 1 < n && s.substr(i, 2) == t) {
          if (s[x] == 'r')
            pb = i + 1;
          else
            pr = i + 1;
          swap(s[x], s[i]);
          ++cnt;
          done = true;
          break;
        }
      }
      if (!done) {
        if (s[x] == 'r')
          s[x] = 'b';
        else
          s[x] = 'r';
        ++cnt;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
