program ans; var ttime, ccount: Integer; i,n,j: Integer; summation: Integer; sum, num: array[1..1020] of Integer; nset_a: array[1..1020000] of Integer; nset_l: Integer; { Trivial&Slow implementation of set } function set_contains(v: Integer): Boolean; var p: Integer; begin set_contains := false; for p:= 1 to nset_l do if nset_a[p] = v then begin set_contains := true; break; end; end; procedure set_add(v: Integer); begin if (not set_contains(v)) then begin inc(nset_l); nset_a[nset_l] := v; end; end; begin readln(ttime); for ccount:= 1 to ttime do begin readln(n); for i:= 1 to n do read(num[i]); sum[1]:= num[1]; for i:= 2 to n do sum[i]:= sum[i-1] + num[i]; nset_l := 0; for i:= 1 to n do for j:= i to n do begin if (i = 1) then summation:= sum[j] else summation:= sum[j] - sum[i-1]; set_add(summation); end; writeln(nset_l); end; end.