import java.util.*; class P2 { static int hcf(int a ,int b) { if(b==0) return a; else return hcf(b,(a%b)); } public static void main(String[] args) { Scanner sc=new Scanner(System.in); int i,j,k,l,m,n,p,q,t; t=sc.nextInt(); for(l=1;l<=t;l++) { n=sc.nextInt(); long prod=1; long c=0L; long arr[]=new long[n]; for(i=0;i<n;i++) { arr[i]=sc.nextLong(); prod*=arr[i]; } for(i=0;i<n;i++) { long a=prod/arr[i]; if(hcf((int)a,(int)arr[i])==1) c+=1L; } System.out.println(c%(1000000007)*2); } } }