#include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     return a ? gcd(b % a, a) : b;   }   template <typename T>   T lcm(T a, T b) {     return (a / gcd(a, b)) * b;   }   string int_to_str_easy(long long n) {     return n ?    : int_to_str_easy(n / 10) + (char)( 0  + n % 10);   }   template <typename T>   T sum(vector<T> v) {     T ans = 0;     for (T i : v) ans += i;     return ans;   }   bool is_down(char x) { return ( a  <= x && x <=  z ); }   bool is_upper(char x) { return ( A  <= x && x <=  Z ); }   bool is_digit(char x) { return ( 0  <= x && x <=  9 ); }   string follow(string s) {     for (int i = 0; i < s.length(); i++)       if (is_upper(s[i])) s[i] +=  a  -  A ;     return s;   }   const long double pi = 3.141592653589793238462643383279;   const long double log23 = 1.58496250072115618145373894394781;   const long double eps = 1e-8;   const long double zero = 0;   const long long INF = 1e18;   const int COUT = 30;   const int prost = 239;   const long long prost64 = 239;   const int two = 2;   const long long MOD = 1000000007;   const int BIG = 1e9;   const int alf = 26;   const int MAX_M = 2001;   const int MAX_N = 2 * 1e5 + 1;   const int km = (1 << 18) - 1;   const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};   const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};   const int dx[4] = {-1, 0, 1, 0};   const int dy[4] = {0, 1, 0, -1};   const int bit_max = 32;   void solve() { return; }   int n;   string s;   int main() {     cin.sync_with_stdio(0);     cin >> n >> s;     string e =   ;     int ans = 0;     for (int i = 0; i < n; i++) {       if (i % 2 == 0)         e +=  r ;       else         e +=  b ;     }     int now = 0;     string w = s;     int no1 = 0;     int no2 = 0;     for (int i = 0; i < n; i++) {       if (w[i] != e[i] && (i + 1) % 2 == 0)         no1++;       else if (w[i] != e[i])         no2++;     }     now = min(no1, no2) + abs(no1 - no2);     ans = now;     now = 0;     e =   ;     for (int i = 0; i < n; i++) {       if (i % 2 == 0)         e +=  b ;       else         e +=  r ;     }     w = s;     no1 = 0;     no2 = 0;     for (int i = 0; i < n; i++) {       if (w[i] != e[i] && (i + 1) % 2 == 0)         no1++;       else if (w[i] != e[i])         no2++;     }     now = min(no1, no2) + abs(no1 - no2);     ans = min(ans, now);     cout << ans;     return 0;   }   