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.util.Stack;
import java.util.StringTokenizer;

public class B {

	public static boolean good(char[] s) {
		for (int i = 1; i < s.length; i++)
			if (s[i] == s[i - 1])
				return false;

		return true;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = in.nextInt();
		char[] s = in.nextLine().toCharArray();
//		if (good(s)) {
//			System.out.println(0);
//			return;
//		}
		int r = 0, b = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'r')
				r++;
			else
				b++;
		}
		int flips = 0;
		if (Math.min(r, b) != n/2) {
			flips = s.length / 2 - Math.min(r, b);
		}
		int ans = flips;
		int switchr = 0, switchb = 0;
		Stack<Character> st = new Stack<>();
		st.add(s[0]);
		for (int i = 1; i < s.length; i++) {
			if (st.peek() == s[i]) {
				if (s[i] == 'b' && switchr > 0) {
					
					switchr--;
					st.add('r');
					continue;
				}
				if (s[i] == 'r' && switchb > 0) {
					switchb--;
					st.add('b');
					continue;
				}
				if (flips > 0) {
					flips--;
					st.add(s[i] == 'r' ? 'b' : 'r');
					continue;
				}
				if (s[i] == 'b') {
					ans++;
					switchb++;
					st.add('r');
				} else {
					ans++;
					switchr++;
					st.add('b');
				}

			} else
				st.add(s[i]);
		}
		System.out.println(ans - (switchr + switchb));

	}

	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();
		}
	}
}
