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.Scanner;

public class newB719 {
	static void swap(int g,int h,char[] s){
		char temp;
		temp=s[g];
		s[g]=s[h];
		s[h]=temp;
	}
	public static void paint(int i,char[] s) {
		// TODO Auto-generated method stub
		if(s[i]=='r'){
			s[i]='b';
		}else
			s[i]='r';
	}
	public static int findconsecutive(int i,int n,char s[]) {
		// TODO Auto-generated method stub
		int x;
		for( x=i+2;x<n-1;x++){
			if(s[x]==s[x+1]&&s[x]!=s[i]){
				break;
			}
			
		}return x;
	}
	
	public static int findsingle(int i,int n,char s[]) {
		// TODO Auto-generated method stub
		int x;
		for( x=i+2;x<n-1;x++){
			if(s[x]!=s[i]&&s[i]==s[i+1]){
				break;
			}
			
		}return x;
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n=0,a=0,b=0,c=0,d=0,i,j,x,count=0;
		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		//String q=sc.nextLine();
		String s1=sc.nextLine();
		s1=sc.nextLine();
	char[]	s2=s1.toCharArray();
	for(i=0;i<n-1;i++){
		c=0;
		if(s2[i]==s2[i+1]){
			c=1;
		//	System.out.println(s2[i]+" "+s2[i+1]);
			x=findconsecutive(i,n,s2);
		//	System.out.println(x+" "+s2[x]+" "+s2[x+1]);
			
			if(x<=n-2&&s2[x+1]==s2[x]&&a==0){
			//	System.out.println(x);
			swap(x+1,i+1,s2);
			count++;
			//for(int k=0;k<n;k++){System.out.print(s2[k]);}
			if(s2[i+1]==s2[i+2]){
				swap(x+1,i+1,s2);
				//for(int k=0;k<n;k++){System.out.print(s2[k]);}
				swap(x,i+1,s2);
				if(s2[i+1]==s2[i+2]){
					swap(x,i+1,s2);
				swap(x+1,i,s2);
				
				//for(int k=0;k<n;k++){System.out.print(s2[k]);}
				if(i!=0&&s2[i]==s2[i-1]){
					swap(x+1,i,s2);
				//	for(int k=0;k<n;k++){System.out.print(s2[k]);}
					paint(i+1,s2);
				//	for(int k=0;k<n;k++){System.out.print(s2[k]);}
				}
			}
			}
		//	System.out.println("i="+i);
			}			
			else {//System.out.println("i="+i);
			//	System.out.println("ejjvcjc");
				x=findsingle(i,n,s2);
				
				if(x<n&&s2[x]!=s2[i])
				{swap(x,i+1,s2);
				count++;}
				
				else
				{
					paint(i+1,s2);
					count++;
				}
			}
		//	for(int k=0;k<n;k++){System.out.print(s2[k]);}
		//	System.out.println(s2[x]+" "+s2[x+1]);
		
		
		
		}
		
		}
	System.out.println(count);
	}
	}
		//System.out.println(count);

