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;
template <typename T>
void alert(const T& t) {
  cout << t;
  exit(0);
}
const long long MAX64 = 1 + 1e+18;
const int MAX = 1 + 1e+9;
const double PI = 3.1415926536;
const long long CEL = 26;
long long MID(long long l, long long r) { return (l + r) / 2; }
long long LSON(long long u) { return u * 2; }
long long RSON(long long u) { return u * 2 + 1; }
string ToLow(string& str) {
  for (int i = 0; i < str.size(); i++) {
    str[i] = tolower(str[i]);
  }
  return str;
}
string ToUp(string& str) {
  for (int i = 0; i < str.size(); i++) {
    str[i] = toupper(str[i]);
  }
  return str;
}
int GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
int LCM(long long a, long long b) { return (a * b) / GCD(a, b); }
template <typename T>
T POW(T a) {
  return a * a;
}
struct SegmentTree {
  vector<long long> sum;
  SegmentTree(long long n) : sum(n * 4) {}
  void Set(long long u, long long sl, long long sr, long long pos,
           long long val) {
    if (sl == sr) {
      sum[u] = val;
      return;
    }
    long long mid = MID(sl, sr);
    if (pos <= mid) {
      Set(LSON(u), sl, mid, pos, val);
    } else {
      Set(RSON(u), mid + 1, sr, pos, val);
    }
    sum[u] = sum[LSON(u)] + sum[RSON(u)];
  }
  long long GetSum(long long u, long long sl, long long sr, long long l,
                   long long r) {
    if (sl == l && sr == r) return sum[u];
    long long mid = MID(sl, sr);
    if (r <= mid) {
      return GetSum(LSON(u), sl, mid, l, r);
    } else if (l > mid)
      return GetSum(RSON(u), mid + 1, sr, l, r);
    else {
      return GetSum(LSON(u), sl, mid, l, mid) +
             GetSum(RSON(u), mid + 1, sr, mid + 1, r);
    }
  }
};
vector<long long> prefix_function(const string& s, const string& input) {
  long long n = (long long)s.length();
  vector<long long> pi(n);
  for (long long i = 1; i < n; ++i) {
    long long j = pi[i - 1];
    while ((j > 0) && (s[i] != s[j] || j == input.size() || i == input.size()))
      j = pi[j - 1];
    if (s[i] == s[j] && i != input.size() && j != input.size()) ++j;
    pi[i] = j;
  }
  return pi;
}
long long n;
vector<vector<long long>> answer;
int main() {
  long long n;
  cin >> n;
  map<char, long long> ma;
  vector<char> ve(n);
  for (long long i = 0; i < long long(n); i++) {
    cin >> ve[i];
    ma[ve[i]]++;
  }
  long long countb = 0, countr = 0;
  for (long long i = 1; i < n; i++) {
    if (ve[i] == ve[i - 1] && ve[i] == 'b') countb++;
    if (ve[i] == ve[i - 1] && ve[i] == 'r') countr++;
  }
  if (n & 1) {
    if (abs(ma['b'] - ma['r']) > 1)
      alert(abs(ma['b'] - ma['r']) / 2);
    else {
      alert(max(countr, countb));
    }
  } else {
    if (abs(ma['b'] - ma['r']) > 0)
      alert(abs(ma['b'] - ma['r']) / 2);
    else {
      alert(max(countr, countb));
    }
  }
  return 0;
}
