#include <iostream>
using namespace std;
int main() {
	int n,h=0,l=1;
	cin>>n;
	string s[n+1][5];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=4;j++) cin>>s[i][j];
		if(i==n) l++;
		if(l>=4){
			h++;
			l=1; 
		}
		if(i!=1){
			if(s[i-1][4]==s[i][1]) l++;
			else l=0;
		}
	}
	cout<<h;
	return 0;
}