EasyRating 800
Magnet Groups
Magnets are placed in a row, each as 01 or 10. Neighbours with the same orientation stick into one group; different ones start a new group. Count the groups.
Input
n, then n lines each 01 or 10.
Output
The number of groups.
Sample 1
Input
6 10 10 10 01 10 10
Output
3
Sample 2
Input
1 01
Output
1
Output appears here