semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{   
   int i,j,k[16],a,p,b,c,q;
   for(i=1;i<1000;i++)
   {
	   p=0;q=0;
	   for(j=0;j<16;j++)
	   {
		   scanf("%d",&a);
         if(a==-1) break;
         else if(a!=-1)
		 { 
		   if(a==0) break;
		   else	 
		   {
			   k[j]=a;
		       p++;
		   }
		 }
	   }
	  if(a==-1) break;
	  for(b=0;b<p;b++)
	  {
		   for(c=0;c<p;c++){ 
	           if(k[b]-2*k[c]==0)
			   q++;
		  }
	  }	   
	  printf("%d\n",q);
   }
      return 0;
}
void main()
{
	int a[16],n,i,j,sum=0;

	a[0]=1;
	while(1){
		for(i=1;a[i-1]!=0;i++){
			scanf("%d",&a[i]);
			if(a[1]==-1) goto end;
		}
		n=i-1;
		for(i=1;i<n;i++){
			for(j=1;j<n;j++){
			if(i==j) continue;
			if(a[i]==2*a[j]) sum++;
			}
		}
		printf("%d\n",sum);
		for(i=1;i<16;i++)
		a[i]=0;
		sum=0;
	}
end:;
}
int main()
{
	int a[17];
	int i, j, n, nn, count;
	nn=0;
	while(cin >> a[1] && a[1] != -1)
	{
		nn++;
		count = 0;
		for (n = 2; n <= 16; n++)
		{
			cin >> a[n];
			if (a[n] == 0)
				break;
		}
		for (i = 1; i <= n - 1; i++)
		{
			if (a[i] % 2 == 0)
				for (j = 1; j <= n - 1; j++)
					if (a[j] * 2 == a[i])
						count++;
		}
		cout << count << endl;
	}
	return 0;
}
int main(int argc, char* argv[])
{  int a[100][15],i=0,j=0,x=10,k=0,m,num=0;
for(i=0;i<100;i++){
	if(x==-1)break;
	for(j=0;j<16;j++){
		scanf("%d",&x);
		if(x==-1)break;
		if(x==0)break;
		a[i][j]=x;
	}

}
k=i;
for(i=0;i<k-1;i++){
	for(j=0;j<15;j++){
		for(m=j+1;m<15;m++){
		if(a[i][j]*1.0/a[i][m]==2||a[i][m]*1.0/a[i][j]==2)num++;
		}
	
	}
	printf("%d\n",num);
	num=0;
}

	return 0;
}
//********************************
//*??????                 **
//*??????  1000012939     **
//*???2012.11.02             **
//********************************
int main()
{
	int a[16];
	while (true)
	{
		cin >> a[0];
		if (a[0] == -1)
			break;
		int n = 0, count = 0;
		while (a[n] != 0)
			cin >> a[++n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
				if (a[i] == 2 * a[j])
					count++;
		}
		cout << count << endl;
	}
	return 0;
}
//********************************
//*?????         **
//*?????? 1200012839 **
//*???2012.10.30   **
//********************************

int main()
{
    int a[15], value;
    while (cin >> value && value != -1)
    {
        a[0] = value;
        int i = 0, count = 0;
        while (a[i] != 0)
        {
            i++;
            cin >> a[i];
        }
        
        for (int j = 0; j < i; j++)
        {
            
            for (int k = 0; k < i; k++)
            {
                if (a[j] == 2 * a[k])
                {
                    count = count + 1;
                }
            }
        }
        cout << count << endl;        
    }
    
    while (value == -1)
    {
        break;
    }
    return 0;
}
int main()
{
    int a[200],i,s=0,cnt=0,q,j;
    while(1)
    {
            s=0;
            cnt=0;
            cin>>a[1];
            if(a[1]==-1)break;
            for(i=2;a[i-1]!=0;i++)
            {
                                  cin>>a[i];
                                  cnt++;
            }
            for(i=1;i<=cnt-1;i++)
            {
                                 for(j=i+1;j<=cnt;j++)
                                 {
                                                      if(a[i]==2*a[j]||2*a[i]==a[j])
                                                      s++;
                                 }
            }
            cout<<s<<endl;
            
    }
    cin>>q;
    return 0;
}
int main()
{
	int a[17],i,j,k,s,n;
	for(k=1;;k++)
	{		
		s=0;n=0;
		for(i=1;;i++)
		{		
			cin>>a[i];
			n++;
			if(a[i]==0||a[i]==-1) break;
		}
		if (a[n]==-1) break;
		for(i=1;i<n;i++)
		{
			for(j=i+1;j<=n;j++)
			{
				if((a[i]*2==a[j])||(a[j]*2==a[i]))
				 {
					s++;
				 }
			}
		}
	    cout<<s<<endl;
	   
	}
	return 0;
}
int main()
{
  int a[1000],i=0,k,x=0,j;
  for(;;)
  {
      scanf("%d",&a[i]);
      i++;
  if(a[i-1]==-1)
  break;
  }
  for(k=0;k<i-1;k++)
  {
      for(j=k+1;j<i-1;j++)
      {
          if(a[k]==2*a[j]||a[j]==2*a[k])
          {
          x++;
          }
          if(a[j+1]==0)
          break;
      }
      if(a[k+2]==0||a[k+2]==-1)
      {
      k=k+2;
      printf("%d\n",x);
      x=0;
      }
  }
  return 0;
}
//******************************
//* author ?? 1200012955    **
//* date 2012.10.29           **
//* description ??          **
//******************************

int main()
{
	int i, j, k, num;                         //i,j,k?????num???????????
	double a[16];
	do                                        //?????????
	{
		for (i = 0; i <=15; i++)              //??????????
		{
			a[i] = 0;
		}
		num = 0;                              //???num
		for (i = 0; i <=15; i++)              //????
		{
			cin >> a[i];
			if (a[i] == 0 || a[0] == -1)      //????0?????????????????????-1???????
			{
				break;
			}
		}
		if (a[0] == -1)                       //??????-1?????
		{
			break;
		}
		for (j = 0; j <= i -1; j++)
		{
			for (k = j + 1; k <= i - 1; k++)
			{
				if (a[j] == 2 * a[k] || a[j] == a[k] / 2.0)    //??????????
				{
					num = num + 1;                             //?????
				}
			}
		}
		cout << num << endl;
	}
	while(1);

	return 0;		
}
int main()
{
	int a[16],sign=1,i,j,k,num;
	for(;;)
	{
		num=0;
		for(i=0;;)
		{
			scanf("%d",&a[i]);
			sign=a[i];
			if(sign==0||sign==-1)break;
			else i++;
		}
		if(sign==-1)break;
		else
		{
			for(j=0;j<i;j++)
			{
				for(k=j+1;k<i;k++)
				{
					if(a[k]==2*a[j]||a[j]==2*a[k])num++;
				}
			}
			printf("%d\n",num);
		}
	}
	return 0;
}
int main()
{
    int i, j, end, k;
	float a[1000];
	int n[100];
	int num[100];
	for(i=0; i<100; i++)
	{
        num[i]=-1;
    } 
	i=0;
	j=1;
	n[0]=-1;
	for(i=1; i<100; i++)
	{
		n[i]=0;
    }
	end=0;
	for(i=0; i<1000; i++)
	{
		scanf("%f", &a[i]);
		if(a[i]==-1)
		{			
            end=i;
			break;
		}
	}
    
	for(i=0; i<end; i++)
	{
		 if(a[i]==0)
		 {
			 n[j]=i;
			 j++;
		 }
	}
    

    
    k=1;
	while(n[k]!=0)
	{
        num[k]=0;
		for(i=n[k-1]+1; i<n[k]; i++)
		{
			for(j=n[k-1]+1; j<n[k]; j++)
			{
				if(a[i]/a[j]==2)
				{
					num[k]++;
				}
			}
		}
		k++;
	}
	
	k=1;
	while(num[k]!=-1)
	{
      
        printf("%d\n", num[k]);
        k++;
    }


	return 0;
}
//********************
//**?????		**
//**?????		**
//**???2013.10.30**
//**????1.cpp	**
//********************
int main()
{
	int i, j, k, m;
	for (i = 1; ; i++) // ?????????????
	{
		int num[16]; // ??1??16????????
		for (j = 1; ;j++) // ????????????
		{
			cin >> num[j]; // ??????
			if (num[j] == 0) // ?????0
				break; // ?????
		}
		if (num[1] == -1) // ????-1
			break; // ??????
		int cnt = 0; // ??????cnt????2?????
		for (k = 1; k <= j - 1; k++)
			for (m = 1; m <= j- 1; m++)
			{
				if (num[k] * 2 == num[m]) // ?????????????????
					cnt++; // cnt?1
			}
			cout << cnt << endl; // ??cnt
	}
	return 0;
}
int main()
{
	int a[100];
	int d,i,t,p=0;
	while(true)
	{
		t=0;
		for(i=0;i<100;i=i+1) a[i]=0;
		while (true)
		{
			scanf("%d",&d);
			if ((d==0)||(d==-1))  break;
			a[d]=1;
		}
		if (d==-1)  break;
		else
		{
			if(p)  printf("\n");
			p=p+1;
		for(i=1;i<50;i=i+1)
					if ((a[i])&&(a[2*i])) t++;
				printf("%d",t);
		}
	}
	return 0;
}
int main()
{
	int a[18] = {0},i,n,ii,s;
	char c;
	while (1)
	{	
		i = 1;
		while (1)
		{
			cin>>a[i];
			if ((a[i] == 0)||(a[i] == -1))
				break;
			i++;
		}
        if (a[i] == -1)
			break;
		n = i;
		i = 1;
		s = 0;
		while (i < n)
		{
			ii = 1;
			while (ii < n)
			{
				if (a[ii] == 2 * a[i])
					s++;
				ii++;
			}
			i++;
		}
		cout<<s<<endl;
	}
	return 0;
}
int main()
{
	int i,j,h,k,m;
	int a[20];
	for(k=0;;k++)
{
		for(i=0;i<16;i++)
	{
		scanf("%d",&a[i]);
		if(a[0]==-1)
		{
			break;
		}
		m=0;
		if(a[i]==0)
		{
			for(j=0;j<i-1;j++)
			{
				for(k=j+1;k<i;k++)
				{
					if(a[k]==a[j]*2||a[j]==a[k]*2)
					{
						m++;
					}
				}
			}
			printf("%d\n",m);
			break;
		}
	}
		if(a[0]==-1)
		{
			break;
		}
		
}
	return 0;
	
	
}
void main()
{
	int a[15];
	scanf("%d",&a[0]);
	int i=1;
	int k=0;
	while(a[i-1]!=0)
	{
		scanf("%d",&a[i]);
		k=k+1;
		i++;
	}
	int j;
	int n=0;
	for (i=0;i<=k-1;i++)
	{
		for(j=0;j<=k-1;j++)
		{
			if(a[i]==2*a[j])
			{
				n=n+1;	
			}
		}
	}
    printf("%d",n);
}
/**
????1.cpp
?  ?????
?  ??10.30
?  ??????????????
*/


int main()
{
	int a[16], i;   
	
    
	for(i = 1;;i++) 
	{
	    int j, k, n = 1, cnt = 0;
		cin >> a[0];
		if (a[0] == -1)break;
		for(j = 1;j < 16;j++)
		{
		    cin >> a[j];
			if(a[j] == 0)break;
		    
            n++;
			
		}
		
		for(j = 0;j < n - 1;j++)
		{
		    for(k = 1;k <= n - j - 1;k++)
			{
			    if(a[j] == 2 * a[j + k] || 2 * a[j] == a[j + k])
				    cnt++;
			}
		  
		}
	    cout << cnt << endl;
	}
	

	
    return 0;
}
int main()
{
    int ch[16], i, j, n, m;
    
    cin >> ch[0];
    
    while(ch[0] != -1)
    {
        n = 0;
        
        for(i = 1; ch[i - 1] != 0; i++)
        {
            n++;
            
            cin >> ch[i];
        }
            
        m = 0;
            
        for(i = 0; i < n; i++)
        {
            if(ch[i] % 2 == 1) continue;
            else
            {
                for(j = 0; j < n; j++)
                { 
                    if(ch[i] == 2 * ch[j]) m++;
                }
            }
        }    
        cout << m << endl;
        
        cin >> ch[0];
    }

    return 0;
}
int main()
{
    int i=0,n,b,c=0,j=0,k,a[1000][18];
    scanf("%d",&b);
    while(b!=-1){
       if(b!=0){  
         a[i][j]=b;
         j++;
         a[i][17]=j;}
       else{
         a[i][j]=b;
         i++;
         n=i;
         j=0;}
       scanf("%d",&b);
    }  
    for(i=0;i<n;i++){
        for(j=0;j<a[i][17]-1;j++){
            for(k=j+1;k<a[i][17];k++){
                if(a[i][j]==2*a[i][k]||a[i][k]==2*a[i][j]){
                   c++;
                }
            }                 
        }
        printf("%d\n",c);
        c=0;
    }
    return 0;
}
int main()
{int n,m,k;
static int a[16];
while(scanf("%d",&a[0])&&a[0]!=-1)
{for(k=1;k<=15;k++)
{scanf(" %d",&a[k]);
if(a[k]==0)
break;}
n=0;
for(k=0;a[k]!=0;k++)
for(m=0;a[m]!=0;m++)
if(a[m]==2*a[k])
{n++;break;}
printf("%d\n",n);}
return 0;
}
//???????????????????
//?????11.3
//????wayne
int main()
{
	int n,a[16],i,t,m,j,k,sum;
	while (cin>>t)                  
	{
		if (t!=-1)                  //??????????
		{
			a[1]=t;
			i=1;
			while (cin>>m)
			{
				if (m!=0)          //????????????
				{ 
					i=i+1;
					a[i]=m;        //??????????????????
				}
                else break;       //???????
			}
			sum=0;
			for (j=1;j<=i;j++)
                 for (k=1;k<=i;k++)
				 {
					 if (a[k]==2*a[j]||a[k]==0.5*a[j])  //??????????????
						 sum=sum+1;             //???????1
				 } 
		   cout<<sum/2<<endl;                   //??????????????2
		}
		else {cout<<endl;break;}                //?-1??????
	}
	return 0;
}
int main()
{
	int a[16], i, j, k, count;			//????a???????count????????????
	while(1)
	{
		for ( i = 0; ; i++ )			
		{
			cin>>a[i];					//????
			if ( a[i] == 0 )			//????0?????????
				break;
			if ( a[0] == -1)			
				break;
		}
		if ( a[0] == -1 )				//????????-1???????
			break;
		count = 0;						//?count??0
		for ( k = 0; k < i; k++ )
			for ( j = 0; j < i; j++ )
				if ( ( a[k] == 2 * a[j] ) || ( a[j] == a[k] * 2 ) )
					count++;			//????????????
				cout<<count/2<<endl;	
				}
	return 0;
}
int main(int argc, char* argv[])
{
	int s[100][15],t[15];
	int sum[100];
	int i,j,n,m,k;
 	for(i=0;;i++){
		for(j=0;;j++){
			scanf("%d",&s[i][j]);
			if(s[i][j]==0){
				t[i]=j;
				break;
			}
			else if(s[i][0]==-1) break;
		}
		if(s[i][0]==-1) break;
	}
	for(n=0;n<i;n++){
		sum[n]=0;
		for(m=0;m<t[n]-1;m++){
			for(k=m+1;k<t[n];k++){
				if(s[n][m]==2*s[n][k]||s[n][k]==2*s[n][m]){
					sum[n]++;
					
				}
			}
		}
	}
	for(n=0;n<i;n++){
		printf("%d\n",sum[n]);
	}
	return 0;
}
int main() 
{ 
    int s[15];int a,b;
	int i,t,h,k;
	for(i=0;i<=100;i++)
	{
		b=0;a=0;
		for(t=0;t<17;t++)
		{
		 scanf("%d",&s[t]);
		 if(s[t]==0)break;
         if(s[t]==-1)break;
		 a++;
		}
	    if(s[t]==-1)break;
		for(k=0;k<a;k++)
		{
			for(h=0;h<a;h++)
			{
				if(s[k]==2*s[h]){b++;}
				else{b=b;}
			 }
		}
	printf("%d\n",b);
	}
    return 0;
}
/**
 * @file   1000012834_002homework.cpp
 * @author ???
 * @date   2010-11-3
 * @description 
 *         ???????1134 ??  
 */
int main()
{										//?????
	int i , j , ii , t , flag;			//???????????????????
	int a[ 2000 ];							//????
	while (1)							//?????-1????????
	{
		t = 0;							//?????
		flag = 1;
		i = 1;
		while (flag == 1)				//?????????0????
		{
			cin >> a[ i ++];			//????????
			if (a[ i - 1 ] == 0)		//????????????
				flag = 0;
			else
				if (a[ i - 1 ] == -1)	//????-1??????????
					return 0;
		}
	/*	i = 1;
	while ((a[i] = cin.get()) != '-1')
	{
          a[i] -=  48;
		i ++;
		t = 0;
		cin.get();
		while ((a[i++] = cin.get()) != '0')
		{	a[i - 1] -= 48;
			cin.get();
		}
		
		**/
			i -= 1;							//????i????????????0
			for (j = 1; j < i; j++)		//??????????,????i++???????-1
			{
				if (a[ j ] % 2 == 0)	//???????????
				{
					for (ii = 1; ii < i; ii++)	//????????????????
					{

						//??????????????
						if (a[ ii ] * 2 == a[ j ])
						t ++;						//???????????1
					}
				}
			}
			cout << t << endl;			//?????????????
	}
	
	return 0;
}										//?????
int main()
{
	int i,j,k,count=0,row,arr[100][100],n[100],b[100];
	for(i=0;i<100;i++){
		count=0;
		for(j=0;j<100;j++){
			scanf("%d",&arr[i][j]);
			if(arr[i][j]==0||arr[i][j]==-1){
				n[i]=count;
				break;
			}
			count++;
		}
		if(arr[i][j]==-1){
			row=i; //last row=-1, n[i]=0
			break;
		}
	}
	
	for(i=0;i<row;i++){
		count=0;
		for(j=0;j<n[i];j++){
			for(k=j+1;k<n[i];k++){
		                if(arr[i][j]==(arr[i][k]*2)||(arr[i][j]*2)==arr[i][k]){
					count++;
				}
			}
		}
		b[i]=count;
	}
	for(i=0;i<row;i++){
		printf("\n%d",b[i]);
	}
	return 0;	
}
int main(int argc, char* argv[])
{
	int s[16]={0};
	while(1){
		int i,j,count=0,flag=0;
		for(i=0;;i++){
			scanf("%d",&s[i]);
			if(s[i]==-1)
			{
				flag=1;
				break;
			}
			if(s[i]==0)
				break;
			count++;
		}
		if(flag)
			break;
		int num=0;
	
		for(i=0;i<count;i++){
			for(j=i;j<count;j++){
				if(s[i]==s[j]*2||s[j]==s[i]*2)
					num++;
			}
		}
		printf("%d\n",num);
	}
	return 0;
}
main()
{
    int a[100][17],i,j,k,s,r;
	for(j=0;j<100;j++)
	{
		r=0;
	    scanf("%d",&a[j][1]);
		if(a[j][1]==-1) break;
		else
		{
			for(i=2,s=1;a[j][i-1]!=0;i++,s++)
				scanf("%d",&a[j][i]);
			for(i=1;i<s;i++)
			{
				for(k=i+1;k<=s;k++) {if(a[j][k]==2*a[j][i]||a[j][i]==2*a[j][k]) r++;}
			}
			printf("%d\n",r);
		}
	}
	return 0;
}
void main()
{
	int c[15],i,m=0;
    for(i=0;i<15;i++)
	{
		scanf("%d",&c[i]);
		if(c[i]==0)
		{
			break;
		}
	}
	
	int k,j,n=0;
	for(k=0;c[k]!=0;k++)
	{
		for(j=0;c[j]!=0;j++)
		{
		
			if(c[k]==2*c[j])
			{
				n++;
				
			}
		}
			
	}
	printf("%d",n);
}
//*****************************************
//* ????? **
//* ?????? 1300012741 **
//* ???2013.10.23 **
//*****************************************


int main()
{
	int list[15] = {0};
	int i, j, num, sum;

	cin >> num;

	while ( num != -1 )
	{
		i = 1;
		j = 0;
		sum = 0;
		list[0] = num;
		while ( ( cin >> list[i], list[i] ) != 0 )
			i++;
		while ( list[j] )
		{
			for ( i = j + 1; list[i]; i++ )
			{
				if ( list[i] == 2 * list[j] || 2 * list[i] == list[j] )
					sum++;
			}
			j++;
		}
		cout << sum << endl;
		cin >> num;
	}

	return 0;
}
int main(int argc, char* argv[])
{ 
	int i,a[16],s=0,j;scanf("%d",&a[0]);
	while(a[0]!=-1)
	{
		for(i=1;i<=15;i++)
		{scanf("%d",&a[i]);
		if(a[i]==0)break;
		for(j=0;j<=i;j++)
			if(a[j]==2*a[i]||a[j]==0.5*a[i])s+=1;
		}printf("%d\n",s);
		s=0;
		scanf("%d",&a[0]);
	}


return 0;
}
/**
* @desc ??????: ??2?1000???????
* @author ??? 1100012829 
* @date 2011-10-12
*/
int main()
{    
int a[16]={0},n,i=1;
for(;a[i]!=-1;)//a[i]??????? 
{
    n=0;
    for(i=0;;i++)//???
    {
            cin>>a[i];
            for(int j=0;j<i;j++)
            {
                    if(a[j]*2==a[i]||a[j]==a[i]*2){n++;}
            }
            if(a[i]==0||a[i]==-1){break;}//?????? -1?????????
    }
    if(a[i]!=-1){cout<<n<<endl;}
}
}
int main ( )
{
	int num[16],i,j,count,a,n;
	while(1)
	{
		count=0;n=0;
		for(i=0;;i++)
		{
			scanf("%d",&num[i]);
			if(num[i]==-1)
				break;
			if(num[i]==0)
				break;
			n+=1;
		}
		if(num[0]==-1)
			break;
		else
		{
			for(i=0;i<n;i++)
			{
				a=num[i];
				for(j=0;j<n;j++)
					if(num[j]==2*a)
						count+=1;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}
int main(int argc, char* argv[])
{
int a[100],i,j,num=0,total=0;
while(1){
	num=0;
while(1){
scanf("%d",&a[num]);
if(a[num]==0) break;
if(a[num]==-1) return 0;
num++;}

total=0;
for(i=0;i<num;i++){

for(j=0;j<num;j++){
if(a[j]==2*a[i]) total++;}}
printf("%d\n",total);}
	return 0;
}
int main()
{
	int n[10000],m[15];
	int *p;
	int i,j,k=0,total,all=0,sum=0,q,t;
	p=&n[0];
	for(i=0;;i++)
	{
		scanf("%d",&n[i]);
		if(n[i]==0)
		{
			all++;
		}
		if(n[i]==-1)
		{
			break;
		}
	}
	while(all>0)
	{
		for(i=0,t=0;n[k]!=0;i++,k++)
		{
			m[i]=n[k];
			t++;
		}
		k=k+1;
		total=0;
		for(q=0;q<t;q++)
		{
			for(j=0;j<t;j++)
			{
				if((m[q]/m[j]==2)&&(m[q]%m[j]==0))
				{
					total++;
				}
			}
		}
	    printf("%d\n",total);
		all--;
	}
	return 0;
}
int main()
{
	int a[20],i=0,j,count=0;
	while(cin>>a[i])
	{
		 if(a[i]==0)
	     {
             cout<<count<<endl;
	         count=0;
                 i=0;
	         continue;
	     }
	
		if(i!=0)
		{
			for(j=0;j<i;j++)
			{
				if( a[j]==2*a[i]||a[i]==2*a[j])
				{count++;}
			}

		}
	     i++;
	}
	
	
	   
	return 0;
}
int main()
{
	int str[20],doubl,num=0,a,b,c;
	while(1)
	{
		num=0;
		scanf("%d",&str[0]);
		if(str[0]==-1)
			break;
		else
			for(a=1;str[a-1]!=0;a++)
			{
				scanf("%d",&str[a]);
			}
			for(b=0;b<a-1;b++)
			{
				doubl=2*str[b];
				for(c=0;c<a-1;c++)
				{
					if(str[c]==doubl)
						num++;
					else
						num=num;
					}
				}
				printf("%d\n",num);
			}
			return 1;
	}
int main(int argc, char* argv[])
{
        int n,i,k,d,total;
		total=0;
        int shuzu[16];
        for(i=0;i<16;i++){
        scanf("%d",&n);
		if(n!=-1){
        shuzu[i]=n;
		if(n==0){
		for(d=0;d<i;d++){
		for(k=0;k<i;k++){
			if(shuzu[d]==2*shuzu[k]){
				total++;}}}
			printf("%d\n",total);
		i=-1;
		total=0;}
         }
		else{
			break;}}

        return 0;
}
int main(void)
{
    int a[MAX], n[100];

    int i, t, j, k, tr, sum[20], l=0;


    while (scanf("%d", &t), t!=-1)
    {   sum[l]=0;
        i=0;
        a[0]=t;
        while(i++,scanf("%d", &a[i]), a[i]);
        for(j=0; j<=i-1; j++)
        {
            for(k=0; k<=i-j-1; k++)
            {
                if(a[k]>a[k+1])
                {
                    tr = a[k];
                    a[k]= a[k+1];
                    a[k+1]= tr;
                }
            }
        }for(j=0; j<=i-1; j++)
        {
            for(k=j+1; k<=i; k++)
            {
                if ((2*a[j])==a[k])
                sum[l]++;
            }}l++;
    }
     for(i=0;i<l;i++)
            printf("%d\n", sum[i]);
    return 0;
}
int main()
{
    int test[100][17]={0};
    
    int i,j,k,num;
    int turn=0,nonzero=0,valid=0;
  
    for(i=0;;i++){
                 for(j=0;;j++){
                               scanf("%d",&num);
                               if(num==0)
                                         break;
                               if(num == -1)
                                          goto start;
                               test[i][j]=num;
                               }
                               turn+=1;
                 }
    start: for(i=0;i<turn;i++){
                               for(j=0;;j++){
                                             if(test[i][j] != 0)
                                                           nonzero+=1;
                                             else
                                                 break;
                                             }
                               for(j=0;j<nonzero;j++){
                                                     for(k=0;k<nonzero;k++){
                                                         if((float)(test[i][j])/(float)(test[i][k]) == 2)
                                                            valid+=1;
                                                         }
                                                         }
                               printf("%d\n",valid);
                               valid=0;
                               nonzero=0;
                               }
    
       return 0;
}
int num[15][20]={0};

int main()
{
	int i,j,k;
	int div(int);

	for(i=0,j=0;;)
	{
		scanf("%d",&num[i][j]);
		if(num[i][j]==-1) break;
		if(num[i][j]==0) 
		{
			j=0;
			i++;
			continue;
		}
		j++;
	}

	for(k=0;k<i;k++)
		printf("%d\n",div(k));
	return 0;
}

int div(int n)
{
	int i,j,k=0;
	
	for(i=0;num[n][i];i++)
		for(j=i;num[n][j];j++)
			if(num[n][i]==2*num[n][j] || num[n][j]==2*num[n][i])
			{
				k++;
			}
	return k;
}
main()
{
	int a[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},i=0,j=0,k=0;
	scanf("%d",&a[0]);
	while (a[0]!=-1)
	{
		
		i=1;
		do 
		{
			scanf("%d",&a[i]);
			if (a[i]<0) {}
			i++;
		}
		while (a[i-1]);
		for (i=0;i<16;i++)
		{
			if (a[i]) 
			{
				for (j=0;j<16;j++)
				{
					if (a[i]==2*a[j]) k+=1;
				}
			}
		}
		printf("%d\n",k);
        for (i=0;i<16;i++) a[i]=0;
		k=0;
		scanf("%d",&a[0]);
	}
	





}
//**************************************************************************
//*??????                                                            *
//*??? ???????????????????????????????   *
//*??????                                                            *
//*???2010?11?03?                                                    *
//**************************************************************************
int main()
{
	int a;                                                   //???????????????
	while (cin >> a)                                         //??????
	{   
		if (a != -1)                                         //????????-1
		{
		int i = 0, j, k, p = 0;                              //?????p?????
		int b[15] = {a};                                     //????????
	    while (b[i] != 0)                                    //???????????0????????
		{
	     	cin >> b[i + 1];
			i ++;                                            //?????????
		}
			for (j = 0; j < i; j ++)                    
			{
				for (k = j + 1; k < i; k ++)
					if (b[k] == 2 * b[j] || b[j] == 2 * b[k]) //?????????????2?
					{
						p = p + 1;                           //???????
					}
			}
				cout << p << endl;                           //??????
		}
	}
	return 0;
}
/*  ??2?15???????????????????????????????????????????? 
????1 4 3 2 9 7 18 22???????3???2?1????4?2????18?9????
 
???? 
??????????????????????2?15????????100??????????????0??????????????????2?15??????????????????????-1,???????????????????
 
???? 
????????????????????????????????????
 
???? 
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
 
???? 
3
2
0            */
 
int main()
{
	int num[100][150],i,j,g,h[100],k,m;
	for(j=0;;j++)
	{
		for(i=0;;i++)
		{
			scanf("%d",&num[j][i]);
			if(num[j][0]==-1)
				break;
			if(num[j][i]==0)
				break;
		}
		if(num[j][0]==-1)
			break;
		h[j]=i;
	}
	g=j;
	int count[100]={0};
	for(j=0;j<g;j++)
	{
		for(i=0;i<h[j];i++)
		{
			k=i;
			for(m=k;m<h[j];m++)
			{
				if(((num[j][m]%num[j][k]==0)&&(num[j][m]/num[j][k]==2))||((num[j][k]/num[j][m]==2)&&(num[j][k]%num[j][m]==0)))
					count[j]++;
			}
		}
		
				printf("%d\n",count[j]);			
	}
	return 1;
}