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.*;
import java.util.*;
public class CF373B
{
	public static final long l = (int) (1e9 + 7);
	private static int[] nextIntArray(InputReader in,int n)	
	{
		int[] a=new int[n];
		for(int i=0;i<n;i++)
			a[i]=in.nextInt();
		return a;
	}
	private static void show(int[] a)
	{
		for(int i=0;i<a.length;i++)
			System.out.print(a[i]+" ");
		System.out.println();
	}
	private static void show2DArray(char[][] a)
	{
		for(int i=0;i<a.length;i++)
		{
			for(int j=0;j<a[0].length;j++)
				System.out.print(a[i][j]);
			System.out.println();
		}
	}
	static class Pair
	{
		private int first;
		private int second;
		public Pair(int i, int j) 
		{ 
			this.first = i;
			this.second = j;
		}
		public int getFirst() { return first; }
		public int getSecond() { return second ;}
		public void setFirst(int k) { this.first=k ; }
		public void setSecond(int k) { this.second=k ;}
	}
	public static void main(String args[])
	{
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		/*------------------------------My Code starts here------------------------------*/
		int i=0,n=in.nextInt();
		char[] a=in.next().toCharArray();
		int[] dp=new int[n];
		boolean[] dp1=new boolean[n];
		Arrays.fill(dp1, false);
		boolean[] dp2=new boolean[n];
		Arrays.fill(dp2, false);
		dp[0]=0;
		for(i=1;i<n;i++)
		{
			if(i==1)
			{
				if(a[i]==a[i-1])
				{
					dp[i]=dp[i-1]+1;
					dp2[i]=true;
				}
				else
					dp[i]=dp[i-1];
			}
			else
			{
				if(a[i]==a[i-1])
				{
					if(dp1[i-1] || dp2[i-1])
						dp[i]=dp[i-1];
					else
					{
						dp[i]=dp[i-1]+1;
						dp2[i]=true;
					}
				}
				else
				{
					if(a[i-2]==a[i-1] && !dp2[i-2] && !dp1[i-2])
					{
						dp[i]=dp[i-2]+1;
						dp1[i]=true;
					}
					else
						dp[i]=Math.min(dp[i-1], dp[i-2]);
				}
			}
		}
		out.println(dp[n-1]);
		out.close();
		/*------------------------------The End------------------------------------------*/
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}