#include using namespace std; typedef long long ll; typedef pair P; typedef pair Q; #define REP(i,n) for(int i=0;i> T; while(T--){ int N; cin >> N; REP(i,N){ int f; cin >> f; c[i+1]+=f; } int ans=0; for(i=1;i<=N;i++) if(c[i]!=0) ans++; cout << ans << endl; } return 0; }