#pragma GCC optimize("Ofast") #include using namespace std; #define rep(i,n) for(int i = 0; i < (n); ++i) #define rep_S(i,r,n) for(int i = r; i < (n); ++i) #define Sort(a) sort(a.begin(), a.end()) #define RSort(a) sort(a.rbegin(), a.rend()) #define Output(a) cout << a << endl typedef long long int ll; typedef vector vi; typedef vector vll; typedef vector vst; const ll INF = 0x1fffffffffffffff; const ll MOD = 1000000007; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main(){ ll t,n,k; cin >> t; rep(i,t){ cin >> n; ll ans = 0; rep(j,n){ cin >> k; if(k == 1){ ans++; } } cout << ans << "\n"; } }