#include<bits/stdc++.h>
using namespace std;
const int N = 55;

void solve()
{
    int n;
    int ans=0;
    scanf("%d", &n);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d", &x);
        if(x!=2)    ans++;
    }
    cout<<ans<<endl;
}
int  main()
{
    int t;
    scanf("%d", &t);
    while(t--)  solve();
    return 0;
}