2 shunfurh shunfurh 于 2017.09.03 09:53 提问

Switch

There are N lights in a line. Given the states (on/off) of the lights, your task is to determine at least how many lights should be switched (from on to off, or from off to on), in order to make the lights on and off alternatively.

Input

One line for each testcase.

The integer N (1 <= N <= 10000) comes first and is followed by N integers representing the states of the lights ("1" for on and "0" for off).

Process to the end-of-file.

Output

For each testcase output a line consists of only the least times of switches.

Sample Input

3 1 1 1
3 1 0 1

Sample Output

1
0

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.03 22:53
已采纳
Csdn user default icon
上传中...
上传图片
插入图片