H. Mufaddal and his love for PUBG

0

0 votes
Easy
Problem

After seeing the subjects of the next semester Mufaddal decided that he should start studing the 4 credit subjects during the summer break itself.He saw that there are two 4 credit subjects. Being not in a mood to start studing during vacations he decided that he will rather do a online course for the 2 subjects.Lets call these subjects- Subject A and Subject B.
The courses Mufaddal wishes to do are full day courses which can be streamed only on the particular day it is uploaded.
There can be 4 possible cases regarding what is uploaded on a particular day-
0. No course material is uploaded.
1. Course material for subject A is uploaded.
2. Course material for subject B is uploaded.
3. Course material for both the subjects is uploaded.

On a certain day Mufaddal can either study Subject A or Subject B or decide to Play PUBG (It's vacations after all).
Mufaddal wishes to minimize the number of days he plays PUBG on as his friends troll him when he can't reach the play area on time :-( and he would hence always prioritize studies over PUBG.
However there is one limitation- He gets bored by the subjects too quickly. He would hence not study the same subject on two consecutive days.
Playing PUBG on consecutive days is fine.
Although he might be a noob in PUBG,he is smart and pre plans his studies.
Given the initial states of each day (According to the 4 cases above) help Mufaddal in determining the minimum number of days he has to play PUBG on.

All the course material is independent and it does not matter if Mufaddal has seen the previous content or not to continue to the certain day's material.

See sample cases for better understanding.

INPUT FORMAT
The first line contains an integer T (1<=T<=10) denoting the number of test cases.
For Each Case
The first line consists of an integer N (1<=N<=100) denoting the number of days Mufaddal wish to preplan.
The second line contains N space seperated states (0,1,2 or 3) denoting the state of the days.

OUTPUT FORMAT
For each Test case print exactly one integer denoting the number of days on which Mufaddal plays PUBG.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

In the first case Mufaddal can study subject A on first day,subject B on third day and play PUBG on 2nd and 4th day.
In the second case Mufaddal can study subject A on day 1,3,5 and 7 and subject B on 2,4 and 6 and hence not play PUBG at all
In the third case Mufaddal can study subject B either on day 1 or 2. He cannot study the same subject on consecutive days and hence will study on only 1 day (either 1 or 2) and play PUBG on the other day.

Editor Image

?