#include using namespace std; int main() { int tt; cin >> tt; while (tt--) { int n; cin >> n; vector f(n); for (int i = 0; i < n; i++) { cin >> f[i]; } int ans = 0; for (int i = 0; i < n; i++) { if (f[i] == 1) { ans++; } } cout << ans << endl; } return 0; }