import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int count = 0;


			if (n==0){
				break;
			}
			String[] step =new String[n];
			for (int i = 0; i < n; i++){
				step[i] = sc.next();
			}
			n = n%2 ==0 ? n : n-1;//????????????????\???°????????£??????????????????????????????????????????
			// if n is 5, commands are compared 1st with 2nd and 3rd with 4th.
			for (int i =0; i < n;i = i+ 2){
				if(step[i].charAt(0)!=step[i+1].charAt(0)){
					count ++;
				}
			}
			System.out.println(count);

		}
	}


}