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

public class Main {

    public static void main(String[] args) {

        Scanner keyboard = new Scanner(System.in);
        //b = true, r = false
        int n = keyboard.nextInt();
        String lineInput = keyboard.next();
        int moves = 0;
        boolean[] line = new boolean[n];
        for(int i = 0; i < n; i++){
            switch(lineInput.charAt(i)){
                case 'b':
                    line[i] = true;
                    break;
                case 'r':
                    line[i] = false;
                    break;
            }
        }
        for(int i = 1; i < n; i++){
            if(line[i] == line[i-1]){
                for(int j = i; j < n; j++){
                    if(line[j] != line[i]){
                        if(line[j+1] == line[j]){
                            line[i] = !line[i];
                            line[j] = !line[j];
                            moves++;
                            break;
                        }
                    }
                    if(j+1 >= n){
                        line[i] = !line[i];
                        moves++;
                        break;
                    }
                }
            }
        }
        System.out.println(moves);
    }
}
