#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=14449999999994; ll mod=998244353 ; int main(){ ll t; cin >> t; for (ll i = 0; i < t; i++) { ll n; cin >> n; ll ans=0; for (ll j = 0; j < n; j++) { ll x; cin >> x; if (x==1) { ans+=1; } } cout << ans << endl; } }