Why the chicken crossed the road has been studied in scientific depth, but surprisingly little research exists on why the cow crossed the road. Farmer John has long been interested in this topic, and a university has now offered him a research project on why cows cross the road.
John's job is to watch cows cross the road. He observes cow positions N times. Each observation consists of one cow number and one position for that cow. John owns 10 cows, so a cow number is an integer from 1 to 10, and a position is either 0 or 1, meaning the left or the right side of the road.
Using this observation record, find the minimum number of times the cows crossed the road. In other words, count how many times a cow with the same number changed its position.