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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;


import java.util.*;


public class Main {




        public static void main (String[]args) throws IOException {
            Scanner in = new Scanner(System.in);


            try (PrintWriter or = new PrintWriter(System.out)) {

             int n=in.nextInt();
             char[]a=in.next().toCharArray();
             TreeSet<Integer>r=new TreeSet<>(),b=new TreeSet<>();
                for (int i = 0; i < n; i++) {
                    if (a[i]=='r')r.add(i);
                    else b.add(i);
                }
                for (int i = 0; i < n-1; i++) {
                    if (a[i]!=a[i+1]){
                        if (a[i]=='r')r.remove(i);
                        else b.remove(i);
                        if (a[i+1]=='b')b.remove(i+1);
                        else r.remove(i+1);
                    }
                }
             int ans=0;
                for (int i = 0; i < n-1; i++) {
                    if (a[i]==a[i+1]){
                        ++ans;
                        if (a[i]=='r'){
                            Integer ceiling = b.ceiling(i);
                            if (ceiling==null){
                                a[i+1]='b';
                            }
                            else{
                                a[i+1]='b';
                                a[ceiling]='r';
                                b.remove(ceiling);
                            }

                        }else{
                            Integer ceiling = r.ceiling(i);
                            if (ceiling==null){
                                a[i+1]='r';
                            }
                            else{
                                a[i+1]='r';
                                a[ceiling]='b';
                                r.remove(ceiling);
                            }

                        }
                    }
                }
                or.print(ans);


            }
        }



    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static int getlen(int r,int l,int a){
        return (r-l+1+1)/(a+1);
    }






    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

class Pair implements Comparable<Pair> {
    int first, second;

    public Pair(int first, int second) {
        this.first = first;
        this.second = second;
    }


    @Override
    public int compareTo(Pair o) {
        if (first!=o.first)return first-o.first;
        return second-o.second;
    }
}

class Tempo {

   int first,second,third;

    public Tempo(int first, int second, int third) {
        this.first = first;
        this.second = second;
        this.third = third;
    }
}