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

import java.util.*;
import java.io.*;
public class A
{
      public static void main(String ar[]) throws Exception
      {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            int n=Integer.parseInt(br.readLine());
            char c[]=br.readLine().toCharArray();
            char cc[]=c.clone();
            char d[]=new char[n];
            char b[]=new char[n];
            
            for(int i=0;i<n;i++)
            {
                  if(i%2==0)
                  { d[i]='r'; b[i]='b'; }
                  else
                  { d[i]='b'; b[i]='r'; }
            }
            int x=0,y=0;
            for(int i=0;i<n;i++)
            {
                  if(c[i]==b[i])
                   continue;
                  if(i==n-1 && c[i]!=b[i])
                  { x++; continue; }
                  if(c[i]!=b[i] && c[i+1]!=b[i+1] && c[i]!=c[i+1])
                  { c[i]=b[i]; c[i+1]=b[i+1]; x++; }
                  else
                  {
                        c[i]=b[i];
                        x++;
                  }
            }
            
            for(int i=0;i<n;i++)
            {
                  if(cc[i]==d[i])
                   continue;
                  if(i==n-1 && cc[i]!=d[i])
                  { y++; continue; }
                  if(cc[i]!=d[i] && cc[i+1]!=d[i+1] && cc[i]!=cc[i+1])
                  { cc[i]=d[i]; cc[i+1]=d[i+1]; y++; }
                  else
                  {
                        cc[i]=d[i];
                        y++;
                  }
            }
            
            System.out.println(Math.min(x,y));
      }
}