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

/**
 * Created by kerolos.atallah on 07/02/2019.
 */
public class TestMain {

    public static void main(String[] args) {
        try {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            String row = sc.next();
            if (n != row.length())
                return;

            int rb = noOfCockroachesMai(n, row, true);
            int br = noOfCockroachesMai(n, row, false);

            if (rb > br)
                System.out.println(br);
            else
                System.out.println(rb);

        } catch (Exception e) {
            e.printStackTrace();
        }


    }

    static int noOfCockroachesMai(int n, String row, boolean rbSeq) {

        int counter = 0;
        int bStack = 0;
        int rStack = 0;

        int index = 0;

        char first = rbSeq ? 'r' : 'b';
        char sec = rbSeq ? 'b' : 'r';

        // for rb sequance
        for (int i = 0; i < n - 1; i += 2) {
            if (row.charAt(i) != first) {
                if (rStack > 0) {
                    rStack--;
                    counter++;
                } else {
                    bStack++;
                }
            }
            if (row.charAt(i + 1) != sec) {
                if (bStack > 0) {
                    bStack--;
                    counter++;
                } else {
                    rStack++;
                }
            }
        }

        if (n % 2 != 0) {
            if (row.charAt(row.length() - 1) != first) {
                if (rStack > 0) {
                    rStack--;
                    counter++;
                } else {
                    bStack++;
                }
            }
        }

        return counter + bStack + rStack;
    }
}
