#include<iostream>
#include<algorithm>
#include<cstring>
#include <random>
#include <chrono>
#include<math.h>
#include<cstdio>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<string>
#include<string.h>
#include<set>
#include<map>
#include<stack>

#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;



void solve() {
	int a=0,b=0,c=0;
	int n;
	cin >> n;
	int temp = n;
	while (n--) {
		int s;
		cin >> s;
		if (s == 1)a++;
		else if (s == 2)b++;
		else c++;
	}
	cout << a + c << endl;
}


int main() {
	speed;
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
}