Beautiful Array

All submissions for this problem are available.
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
A sequence of integers is beautiful if each element of this sequence is divisible by 4.
You are given a sequence a_{1}, a_{2}, ..., a_{n}. In one step, you may choose any two elements of this sequence, remove them from the sequence and append their sum to the sequence. Compute the minimum number of steps necessary to make the given sequence beautiful.
Input
 The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
 The first line of each test case contains a single integer n.
 The second line contains n spaceseparated integers a_{1}, a_{2}, ..., a_{n}.
Output
For each test case, print a single line containing one number — the minimum number of steps necessary to make the given sequence beautiful. If it's impossible to make the sequence beautiful, print 1 instead.
Constraints
 1 ≤ T ≤ 10^{5}
 1 ≤ n ≤ 10^{5}
 1 ≤ sum of n over all test cases ≤ 10^{6}
 0 ≤ a_{i} ≤ 10^{9}
Example
Input: 1 7 1 2 3 1 2 3 8 Output: 3
Author:  chemthan 
Tester:  kingofnumbers 
Editorial  https://discuss.codechef.com/problems/BTAR 
Tags  chemthan, chemthan, cook89, easy, greedy, likecs 
Date Added:  19122017 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 