PRI3: Disturbed People // Intermediate

 

There is a house with flats situated on the main street of the Shire. George is watching this house every night. The house can be represented as an array of integer numbers where if the light in the flat is on and otherwise.

George thinks that a person in the flat is disturbed and cannot sleep if and only if and and .

George is concerned by the following question: what is the minimum number such that if people from exactly pairwise distinct flats will turn off the lights then nobody will be disturbed? Your task is to find this number .

Input Format

The first line contains the number of test cases, .

In each test case:

The first line of the input contains one integer () — the number of flats in the house.

The second line of the input contains integers , where is the state of the light in the flat ( is either for off or for on).

Sample Input

2
10
1 1 0 1 1 0 1 0 1 0
5
1 1 0 0 0

Output Format

For each test case, print only one integer — the minimum number such that if people from exactly pairwise distinct flats turn off the light then nobody will be disturbed.

Sample Output

2
0

Show Hints


You must be logged in to submit a solution.