semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/**
* ???1000012725
* ??: ??
* ???1134 ??
* ?????????2?15????????????????
* ??????????????????????????
**/

int main()
{
	
	int i , j , f = 0;                      //??i?j??????f???????????
	while(f == 0)                           //?f?0??????????
	{
		int a[16] , count = 0;              //????a[16]?????count???????????????0
		for (i = 0; ; i ++)      
		{
			cin >> a[i];                    //????a[i]??
			if (a[i] == 0)                  //??a[i]???0
			{
				cout << count << endl;      //??count?????
				break;
			}
			else if (a[i] == -1)            //?a[i]?-1????????f??1????????
			{
				f = 1;
				break;
			}
			else                            //????????
			{
				for (j = 0; j < i; j ++)
				{
					if ((a[i] == a[j] * 2) || (a[j] == a[i] * 2))  //?????????????????1
					count ++;
				}
			}
		}
	}
	return 0;
}
void main()
{
  int b,d=0,s[15],i,j;
  while(1)
  {
  scanf("%d",&s[0]);
  if(s[0]==-1)   break;
  for(i=1;s[i-1]!=0;i++)
  scanf("%d",&s[i]);
  for(i=0;s[i]!=0;i++)
  for(j=0;s[j]!=0;j++)
  {
	  if(s[i]==s[j]*2)
      d++;
      else d=d;
  }
  printf("%d\n",d);
   d=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,???????????????????

????
????????????????????????????????????

?? 1000012760
*/


int main(){

	int a[16], i= 0, j= 0, n= 0, Two;

	for(i= 0; i< 16; i++){
		a[i]= 0;
	}
	
	while(1> 0){

		n= 0;
		Two= 0;
		
		for(i= 0; i< 16; i++ ){
			cin>>a[i];
			if((a[i]== 0) || (a[0]== -1))  break;
			else	n++;
		}
		
		if(a[0]== -1)  break;

		for (i= 0; i< n; i++){
			for(j= i+ 1; j< n; j++){
				if((a[i]== (2* a[j])) || (a[j]== (2* a[i]))){
					Two++;
				}
			}
		}

		cout<<Two<<endl;
	}

	return 0;
}
int main()
{
	int a[100][100]={0},i=0,j=0,n=0,l[100]={0},d,N[100]={0};
	do
	{
		j=0;
		do
		{
			scanf("%d",&a[i][j]);
			j++;
		}
		while(a[i][j-1]!=0&&a[i][j-1]!=-1);
		l[i]=j-1;
		i++;
	}
	while(a[i-1][j-1]!=-1);
	n=i-1;
	for(i=0;i<n;i++)
	{
		for(j=0;j<l[i];j++)
		{
			for(d=j;d<l[i];d++)
			{
				if(a[i][d]==2*a[i][j]||a[i][j]==2*a[i][d])
					N[i]++;
			}
		}
	}
	for(i=0;i<n;i++)
		printf("%d\n",N[i]);
	return 0;
}
int main()
{
	int a,b[100][15],c,i,m,x,y,n,e;
	c=0;
    i=0;
		for(m=0;m<16;m++){
			scanf("%d",&a);
			  if(a!=0){
		        b[i][m]=a;
				}
			  if(a==0){
				 	for(x=0;x<m;x++){
					 for(y=0;y<m;y++){
						n=b[i][x]/b[i][y];	
						e=b[i][x]%b[i][y];
                           if(n==2&&e==0){
							c++;
						}
					}	
				}
			printf("%d\n",c);
			 c=0;
			 m=-1;
			 i++;
		} 
		if(a==-1)
				break;
		}
		return 0;
		}
void main()
{
	int i,l,k,g[1000][16],o;
	for(i=0;i<=999;i++)
	{
		int s=0;
		for(l=0;l<16;l++)
		{
			scanf("%d",&g[i][l]);
			if(g[i][l]==0)break;
		}
		if(g[i][0]==-1)break;
		for(o=0;o<14&&g[i][o]>0;o++)
		{
			for(k=o+1;k<15;k++)
			{
				if(g[i][k]-2*g[i][o]==0||g[i][o]-2*g[i][k]==0)
					s=s+1;
			}
		}
		printf("%d\n",s);
	}
	
}
int main()
{         
	int	A[16],pause,i,k,m,count;

	for(;;){
		    count=0;
		    for (i=0;i<16;i++){
		               scanf("%d",&A[i]);
		               if(A[i] == 0 ||A[i] == -1){
                       break;
                       }
	        }
			if(A[i] == -1){
						break;
			}
			for(i=0;i<16;i++){
							if(A[i] == 0){
								pause=i;
								 break;
							}
      			}
			for(k=1;k<pause;k++){
					for(i=0;i<pause-k;i++){
							if (A[i] <= A[i+1])/*????*/
								{
									m=A[i];
									A[i]=A[i+1];
									A[i+1]=m;
								}
					}
			}
			for(k=0;k<pause;k++){
					for(i=k+1;i<pause;i++){
							if ( A[k] == 2*A[i])/*??2?*/{
								count++;
							}
					}
			}	
			printf("%d\n",count);
	}     
   return 0;
}
int main(int argc, char* argv[])
{
	int shuzu[16]={0},i,j,pair=0,n;
		for(i=0;shuzu[0]!=-1;i++)
		{
			scanf("%d",&shuzu[i]);
			if(shuzu[i]==0)
			{	
				n=i;
				for(i=0;i<n;i++)
				{
					for(j=0;j<n;j++)
					{
						if(shuzu[i]==2*shuzu[j])
							pair++;
					}
				}
				printf("%d\n",pair);
				i=-1;
				pair=0;
			}
		}
	return 0;
}
int number(int a[],int m)
{
	int i,j,s=0;
	for(i=1;i<=m;i++)
		for(j=1;j<=m;j++)
			if(a[i]==2*a[j])
				s++;
	return(s);
}

main()
{
	int a[17],b[100];
	int i,j=1;

	scanf("%d",&a[1]);
	while(a[1]!=-1){
		for(i=2;i<=16;i++){
			scanf("%d",&a[i]);
			if(a[i]==0) break;
		}
		i--;
		b[j]=number(a,i);
		scanf("%d",&a[1]);
		j++;
	}

	for(i=1;i<=j-1;i++)
		printf("%d\n",b[i]);
}
int main(){
	int n[100][16];
	int i,j,r,p;
	
	for(i=0; i<100; i++)
	{
		scanf("%d",&n[i][0]);
        if(n[i][0]==-1)  break;

        for(j=1; n[i][j-1]!=0; j++)
		{
			scanf("%d",&n[i][j]);
		}
		int t=0;
		for(r=0;r<j-1;r++)
		{
			for(p=r+1;p<j;p++)
			{
				if(n[i][p]==2*n[i][r])
				{
					t++;
					break;
				}
			}
		}
		for(r=j-1;r>0;r--){
			for(p=r-1;p>=0;p--)
			{
				if(n[i][p]==2*n[i][r])
				{
					t++;
					break;
				}
			}
		}

		printf("%d\n",t);
	}
	return 0;
}
int main()
{
	int t,i,j,k,count;
	int group[15];
	scanf("%d",&t);
	do
	{
		i=0;
		do
		{
			group[i]=t;
			scanf("%d",&t);
			i++;
		}
		while(t!=0); 
		printf("\n");
        	    count=0;
		for(j=i-1;j>=0;j--)
		{
		   for(k=0;k<i;k++)
		   {
		      if((double)group[k]/2==group[j])//double
			  {
		      count++;
			  }
			  else if((double)group[j]/2==group[k])//!=int!!!!!!!
			  {
		      count++;
              			  }
		   }
		}
	    printf("%d\n",count/2);
		scanf("%d",&t);
		
	}
	while(t!=-1);	
	return 0;
}
int main()
{
	int a[16]={0},b[16]={0},c[100]={0},i,n,j,k,l,num;
	l=0;
	for(j=0;j<100;j++){
		n=0;
		for(i=0;i<16;i++){
			scanf("%d",&a[i]);
			if(a[i]==-1){
				break;
			}
			if(a[i]==0){
				break;
			}
			n++;
		}
		num=0;
		for(i=0;i<n;i++){
			b[i]=a[i];
			for(k=0;k<n;k++){
				if(b[i]==2*a[k]){
					num++;
				}
			}
		}
		c[j]=num;
		l++;
		if(a[0]==-1){
			break;
		}
	}
	for(j=0;j<l-1;j++){
		printf("%d\n",c[j]);
	}
	return 0;
}
int main()
{
int b,d=0,s[15],i,j;

while(1)
{
scanf("%d",&s[0]);
if(s[0]==-1)   break;


for(i=1;s[i-1]!=0;i++)
scanf("%d",&s[i]);


for(i=0;s[i]!=0;i++)
for(j=0;s[j]!=0;j++)
{if((s[i]==s[j]*2)&&(s[i]!=0)&&(s[j]!=0))
    d++;
}
printf("%d\n",d);
   d=0;

}
return 0;
}
void main()
{
	int a[16],i,j,k,counter;
	for(;;){
		scanf("%d",&a[0]);
		if(a[0]==-1)
			break;
		else{
			counter=0;
			for(i=1;;i++){
				scanf("%d",&a[i]);
				if(a[i]==0)
					break;
			}
			for(j=0;j<i;j++){
				for(k=0;k<i;k++){
					if(a[j]%a[k]==0&&a[j]/a[k]==2)
						counter=counter+1;
				}
			}
			printf("%d\n",counter);
		}
	}
}
/*
 * liangbei.cpp
 *
 *  Created on: 2010-11-12
 *      Author: ??
 */

int main()
{
	int a[20];
	int i;
	int n=0;
	int num=0;
	int j;
	while(1)
	{
		n=0;//??
		num=0;
	    for(i=0;i<20;i++)//??????
	    {
	    	cin>>a[i];
		    if(a[i]==0)//????0???????
		    	break;
		    if(a[i]==-1)//????-1???????
		    	return 0;
		    n++;//?????????
	    }
	    for(i=0;i<n;i++)
	    	for(j=i+1;j<n;j++)
	    		if(a[i]==2*a[j]||2*a[i]==a[j])//???????????????
	    			num++;//???????
	    cout<<num<<endl;
	}
	return 0;

}
int main()
{
    int num[16]={0},i=0,j=0,sum=0;
    while(1)
    {
        scanf("%d",&num[0]);
        if(num[0]==-1) break;
        for(i=1;num[i-1]!=0;i++)
        {
            scanf("%d",&num[i]);
        }
        for(i=0;num[i]!=0;i++)
        {
            for(j=0;num[j]!=0;j++)
            {
                if((num[i]==2*num[j])&&(num[i]!=0)&&(num[j]!=0))
                sum++;
            }
        }
        cout<<sum<<endl;
        sum=0;

    }
    return 0;
}
void main()
{
	int w;
	for(w=1;;w++)
	{
	int a[16],b=0;
	int i,j,q;
	for(i=1;;i++)
	{
		scanf("%d",&a[i]);
		if(a[1]==-1) break;
		if(a[i]==0) break;
		b++;
	}
	if(a[1]==-1) break;
	int m=0;
	for(j=1;j<b;j++)
	{
		for(q=j+1;q<=b;q++)
		{
			if(a[j]==2*a[q]) m++;
			else if(a[q]==2*a[j]) m++;
		}
	}
	printf("%d\n",m);
    }
}
main()
{
	int a[16],i,j,k,n,x,y;
	for(;;)
	{
		j=0,n=0;
		scanf("%d",&a[0]);
		if(a[0]==-1)
			break;
		for(i=1;i<16;i++)
		{
			scanf("%d",&a[i]);
			j++;
			if(a[i]==0)
				break;
		}
		for(i=0;i<j;i++)
		{
			for(k=i+1;k<j;k++)
			{
				x=a[i]%a[k];
				y=a[i]/a[k];
				if((x==0)&&(y==2))
					n++;
			}
		}
		for(i=j-1;i>=0;i--)
		{
			for(k=i-1;k>=0;k--)
			{
				x=a[i]%a[k];
				y=a[i]/a[k];
				if((x==0)&&(y==2))
					n++;
                               }
                    }
		printf("%d\n",n);
	}
	return 0;
}
int main()
{
	int i=0,j=0,k=0,x=0,y=1,a=0;
	float n[20];
	do{
		i=0;
		j=0;
		k=0;
		x=0;
		y=1;
		do{
		    scanf("%d",&n[j]);
		    if(n[j]==0||n[j]==-1)break;
		    j++;
		}while(j<20);
		if(n[j]==-1)return 0;
		do{
		    do{
			    if(n[x]==n[y]*2||n[x]==n[y]/2)i++;
			    y++;
			}while(y<j);
		    x++;
		    y=x+1;
		}while(x<j);
	    printf("%d\n",i);
	}while(a<1);
	return 0;
}
//* ??
//* ??? 1100012820
//* 20111019
//*******************
int main()
{
	int a[16] = {0}, i = 0, n = 0, j, flag = 1;
	while(flag)
	{
		while(1)
		{
			cin >> a[i];
			if (a[i] == (-1))
			{
				flag = 0;
				break;
			}
			else if (a[i] == 0) 
			{
				for (j = 0; j <= i; j++)
					a[j] = 0;
				cout << n << endl;
				n = 0;
				i = 0;
				break;
			}
			else
			{
				for (j = 0; j < i; j++)
				{
					if ((a[j] == 2 * a[i]) || (a[i] == 2 * a[j]))
						n++;
				}
			}
			i++;
		}
	}
	return 0;
}
int main()
{
	int a[ 17 ] , n , m , i = 1 , t = 0 ;

	cin >> a[ 1 ] ;

	while( a[ i ] != -1 )
	{
		while( a[ i ] > 0 ) 
		{
			i = i + 1 ;
			cin >> a [ i ] ;
		} 

		for( m = 1 ; m < i ; m ++ )
			for( n = m + 1 ; n <= i ; n ++ )
				if( a[ m ] == 2 * a[ n ] || a[ n ] == 2 * a[ m ] )
					t = t + 1 ;

		cout << t << endl ;

		for( i = 0 ; i < 17 ; i ++ )
			a[ i ] = 0 ;

		t = 0 ;
		i = 1 ;
		
		cin >> a[ 1 ] ;
	}

	return 0 ;
}
void main()
{
	int a[200],k,i,n=0,j=0;
   		for(i=0;i<200;i++)
		{	
			scanf("%d",&a[i]);
			if(a[i]!=-1&&a[i]!=0)
				n=n+1;
			if(a[i]==-1)
				break;	
			if(a[i]==0)	
				{	
					for(k=0;k<n;k++)
					{		
						for(i=0;i<n;i++)
						{	
							if(a[k]==2*a[i])
							j=j+1;
						}
					}
					printf("%d\n",j);
					j=0;
					i=-1;
					n=0;
				}
		}
}
//**************************************
//*??????                        *
//*???????????              *
//*??????                        *
//*?????11.5                      *
//**************************************




int main()
{
	int a[16];
	for (int i = 0;;)
	{
		cin >> a[i];
		if (a[i] != 0 && a[i] != -1)
		{
			i ++;
			continue;
		}
		else if (!a[i])
		{
			int n = 0;
			for (int j = 0;j <i - 1; j ++)
			{
				for (int k = j + 1; k < i; k ++)
				{
					if (((a[j] / a[k] == 2) && !(a[j] % a[k])) || ((a[k] / a[j] == 2) && !(a[k] % a [j])))
					n ++;
				}
			}
			cout << n << endl;
			i = 0;
			continue;
		}
		else
			break;
	}
	return 0;
}
int main()
 {
     int a[15] ;
     int i, NO, tmp , n ,j ; 
 while(1)
 {
   n=0;
   scanf("%d",&tmp);
   a[0]=tmp;
   if(tmp == -1) break;
  
   NO = 0;
  
   //for(i = 0; i < 101; i++) a[i] = 0; //a[i] ??i???? ? 0?????1???? ?????????? 

  // a[tm] = 1;
  
   while(1)
   {
    scanf("%d",&tmp);
    if(tmp==0)break;       
    a[++n] = tmp; // ???tmp??tmp??????1 
   }
   for(i = 0; i < n ; i++) 
    for( j=i+1 ; j<=n ; j++ )
      if( a[j]==2*a[i]||a[i]==2*a[j] )      NO++;
 
   printf("%d\n",NO);
 
 
 }
 getchar();
 getchar();
}
int main()
{
	int a[100000],i,j,k,h,g,n,sign;	
	for(i = 1; ; i++)
	{
		cin >> a[i];
		if(a[i] == -1)
			break;
	}
	for(j = 1; j <= i - 1; j++)
	{
		if(a[j] == 0)
		{	
			for(k = j - 1; k >= 1; k--)
			{	
				if(a[k] == 0)
				{	
					break;
				}
			}
			sign = 0;
			for(h = k + 1; h < j; h++)
			{	
				for(g = k + 1; g < j; g++)
				{	
					if(a[h] == 2 * a[g])
						sign++;
				}
			}
			cout << sign << endl;
		}
	}
	return 0;
}
int main()
{
	int a[16],i,k,j,sum=0,m;
	
	for(k=1; ;k++)
	{
		sum=0;
		scanf("%d",&a[0]);
		if(a[0]==-1) break;
		if(a[0]!=-1)
		{
			for(i=1; ;i++)
			{
				scanf("%d",&a[i]);
				if(a[i]==0) 
				{
					m=i;
					break;
				}
			}
		}
		for(i=0;i<m-1;i++)
		{
			for(j=i+1;j<m;j++)
			{
				if(a[i]==2*a[j]||a[j]==2*a[i])
					sum=sum+1;
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}
/*   ???????
     ???????
	 ?????2010?11?5?
	 ???????????????????????????????????
*/
int main()
{
	int num[15]={0} , i , j , a , b=0 , m ;
	do
	{   for (m = 0 ; ; m ++)
		{
		cin >> a ;
	    num[m] = a ;
		if (a == 0) break ;
		if (a == -1) break ;
		}
		for (i = 0 ; i <= m ; i ++)
			for (j = 0 ; j <= m ; j ++)
				if((num[i] != 0 && num [j] != 0 && num[i] * 2 == num[j]) || (num[i] != 0 && num [j] != 0 && num[j] * 2 == num[i]))   b++;
		if (a != -1)  { cout << b/2 << endl ; b=0 ; }
	} while(a != -1);
	return 0 ;
}
int main()
{
	int i,j,n=0,a[16],shu,sum=0;
	while (1)
	{
		scanf("%d",&shu);
		if (shu==-1)
			return 0;
		else if (shu==0)
		{
			for (i=1;i<=n;i++)
			{
				if (a[i]&&a[i]%2==0)
				{
					for (j=1;j<=n;j++)
						if (a[j]==a[i]/2)
							sum++;
				}
			}
			printf("%d\n",sum);
			sum=0;
			n=0;
		}
		else
		{
			n++;
			a[n]=shu;
		}
	}
	return 0;
}
/*
 * 1134 ??.cpp
 *
 *  Created on: 2010-11-16
 *      Author: Administrator
 */

int main(){
	int a[16];
	for(int i=0;;i++){
		cin>>a[i];
		switch(a[i]){
		case -1:return 0;//??0?????
		case 0:{int s=0;
			for(int j=0;j<i;j++)
				for(int k=j;k<i;k++)
					if(a[j]==2*a[k]||a[k]==2*a[j])
			         s++;//????
			         i=-1;
			cout<<s<<endl;//????
		}
		}
	}


}
int main()
{
	int a[16]={-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2},sum=0,i,j,s,t;

A:	for(i=0;a[i]!=-1;i++)
{
		sum=0;
a[0]=-2;a[1]=-2;a[2]=-2;a[3]=-2;a[4]=-2;a[5]=-2;a[6]=-2;a[15]=-2;a[7]=-2;a[8]=-2;a[9]=-2;a[10]=-2;a[11]=-2;a[12]=-2;a[13]=-2;a[14]=-2;
	for(s=0;s<=15;s++)
	{
		scanf("%d",&a[s]);
		if(a[s]==0)
		{
           for(t=0;t<=15;t++)
		   {
			   for(j=0;j<=15;j++)
			   {
				   if(a[j]!=0&&a[t]!=0&&a[t]==a[j]*2)
					   sum++;
			   }
		   }
		   printf("%d\n",sum);
		   break;
		}
		else if(a[s]==-1)
			goto A;
	}

}
 
	return 0;
}
//********************************
//*?????   **
//*?????? 1300012745 **
//*???2013.10.31  **
//********************************
int main()
{
	int a[16], num, i=1, j=0, k=0, l=0;
	while(cin>>a[0])
	{
		//a[15]={0};
		num=0;
		//cin>>a[0];
		if (a[0]==-1)
			break;
		for (i=1;i<=15;i++)
		{
			cin >> a[i];
			if (a[i]==0)
				break;
		}
		for (j=0;j<=15;j++)
			for (k=0;k<=15;k++)
				if ((a[j] != 0) && (a[k] != 0) && (a[j] == 2 * a[k]))
					num++;
				for (l=0;l<=15;l++)
					a[l]=0;
				cout<<num<<endl;
				}
	return 0;
}
int main(int argc, char* argv[])
{
	int i,k;
	while(1){
		int sz[16];
		int add=0;
		for(i=0;i<16;i++){
			scanf("%d",&sz[i]);
			if(sz[i]==0||sz[i]==-1){
			break;
			}
			
		}
		if(sz[0]==-1){
		break;
		}for(i;i<16;i++){
			sz[i]=0;
			}
		for(i=0;i<16;i++){
			for(k=0;k<16;k++){
				if(sz[k]!=0&&sz[k]==2*sz[i]){
					add=add+1;
				}
			}
		}
		printf("%d\n",add);
	}
	return 0;
}
/*
 * 1134 ??.cpp
 *
 *  Created on: 2010-11-12
 *      Author: ???
 */
int main()
{
	int a[16],i,j,k,l,n;         //????
	k=0;
	while (k!=-1)               //-1????
	{
		if (a[0]==-1)break;    //-1????
		i=0;l=1;
		do                     //??????
		{
			i=i+1;
			cin>>a[i];
			l=i+1;
		}while(a[i]!=0);
		l=l-1;n=0;
		for (i=0;i<l;i++)      //???????
			for (j=0;j<l;j++)
			{
				if (a[i]==2*a[j])
					n=n+1;
			}
		cout<<n<<endl;        //??
		for (i=0;i<16;i++)
			a[i]=0;
		cin>>a[0];
		k=a[0];
	}
	return 0;
}
int main(){
while(1){
  int a[16];int i=0,n=0,k;
 while(1){
 scanf("%d ",&a[i]);
 if(a[i]==0)break;
 if(a[i]==-1)return 0;
 i++;}
for(i=0;a[i]!=0;i++)
 for(k=0;a[k]!=0;k++)
 {
     if(a[k]==2*a[i]) n++;
 }

 printf("%d\n",n);}}
int main()
{
	int a[16],i,j,m,n,t;
	while(a[0]!=-1){
		t=0;n=0;
		for(i=0;;i++){
			scanf("%d",&a[i]);
			if(a[i]<=0){
				break;
			}
			else{
				t++;
			}
		}
		if(a[0]==-1){
			break;
		}
		else{
		for(j=0;j<t;j++){
			for(m=0;m<t;m++){
				if(a[j]==2*a[m]){
					n++;
					}
				}
			}
			printf("%d\n",n);
		}
	}
	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=0;j<count;j++){
				if(s[i]==s[j]*2)
					num++;
			}
		}
		printf("%d\n",num);
	}
	return 0;
}
int main()
{
	int num[100]={0},index=0,sum=0;
	char c;
for(;num[0]!=-1;)
{while(true)
	{
		scanf("%d",&num[index++]);
		scanf("%c",&c);
		if(c=='\n')	
			break;
	}
for(int i=0;i<index;i++)
{
	for(int j=0;j<index;j++)
	{
		if(num[i]==(2*num[j])||(2*num[i])==num[j])
		{
			sum++;		
		}
	}
}
if(num[0]==-1)
{return 0;}
else 
printf("%d\n",(sum-1)/2);
sum=0;index=0;
}
return 0;
}
int main(int argc, char* argv[])
{
	int a=1,i=0,j,k,n=0,zs=0;
	int num[15];
	while(a!=-1){
		
		scanf("%d",&a);
		if(a!=0){
			num[i]=a;
			n++;
			i++;
		}
		else{
			for(j=0;j<n;j++){
				for(k=0;k<n;k++){
					if(num[j]==2*num[k]){
						zs++;}}}
			printf("%d\n",zs);
			i=0;
			n=0;
                           zs=0;}
	}
	
	return 0;
}
/**
*@file 1.cpp
*@author ???
*@date 2013-10-30
*@description ??
*/


int main()
{
    int a[30], i, j, count1, count2 ;
    while(scanf("%d",&a[0]),a[0]!=-1)
 {
    count2=0;
    i=0;
    while(a[i]){scanf("%d",&a[++i]);}
    count1=i-1;
    for(i=0; i<=count1; i++)
    {
        for(j=i+1; j<=count1; j++)
            if(a[i]==2*a[j]||a[j]==2*a[i])
            count2++;
    }
    cout << count2 << endl ;
 }
    return 0;
}
/*
 *  qizhongceshi9.cpp
 *  ???????????????????????????????
 *  Created on: 2010-11-13
 *      Author: william
 */
int main()  //???
{
	int a[16], k, i, j;  //??????k i j ???a[]
	for(k=0;;k++)  //for?? 
	{
		int n=-1, num=0;  //?????? n num ????
		for(i=0;i<16;i++)  //for?? ???a??
		{
			cin>>a[i];
			n++;         //????? n?1
			if(a[i]==0)  //??????????0  
				break;  //?????
		}
		if(a[0]==-1) //??????????-1 ?????
			break;
		for(i=0;i<n;i++)  //for??
			for(j=i+1;j<n;j++)  //for??
			{
				if(a[i]==2*a[j]||a[j]==2*a[i])  //???????? ??2???
					num++;  //num??
			}
		cout<<num<<endl;  //??num
	}
	return 0; //??
}  //??
int main()
{
    int l1,l2;
    int pair(int n[15]);
    int num[15]={0};
    for (l1=0;(num[0]!=-1);l1++){
        scanf("%d",&num[0]);
        for (l2=1;(num[l2-1]!=0)&&(num[0]!=-1);l2++){
            scanf("%d",&num[l2]);
            }
        if (num[0]!=-1) printf("%d\n",pair(num));
        }
	return (0);	
}
int pair(int n[15])
{
    int sum,i,j,k,x;
    sum=0;
    for (i=1;(n[i]!=0);i++){
        if (n[i]==(n[0]+n[0])) sum=sum+1;
        }
    for (j=1;(n[j-1]!=0);j++){
        for (k=0;(n[k]!=0);k++){
            if (n[k]==n[j]*2) sum=sum+1;
            }
        }
    return(sum);
    }
void main()
{
	int a[100][16],i,j,k;
	for(i=0;;i++)
	{
		scanf("%d",&a[i][0]);
		if(a[i][0]==-1) break;
		else
		{
			for(j=1;j<16;j++)
			{
				scanf("%d",&a[i][j]);
				if(a[i][j]==0) break;
			}
		}
	}

	for(i=0;i<100;i++)
	{
		
    	int num=0;
		if(a[i][0]==-1) break;
		else
		{
			for(j=0;(j<16)&&(a[i][j]!=0);j++)
			{
				for(k=j+1;(k<16)&&(a[i][k]!=0);k++)
				{
					if(a[i][k]==2*a[i][j]) num++;
					else if(a[i][j]==2*a[i][k]) num++;
				}
			}
		}
     	printf("%d\n",num);
	}



}
int main()
{
	int i,j,line,n;
	for(line=1;;line++){
		int a[16]={0};
		n=0;
	for(i=0;i<16;i++){
	scanf("%d",&a[i]);
	if(a[0]==-1)
		goto A;
	else if(a[i]==0)
		break;
       }
	for(i=0;i<16;i++){
		for(j=0;j<16;j++){
			if(a[i]==2*a[j]&&a[i]!=0){
			n++;
			break;
			}
		
		}
	}
	printf("%d\n",n);
	}
A:
	return 0;
}
int main()
{
	int n=100,m=16,i=1,j,k,t=0;
	int a[16];
	while(n>0)
	{
		cin>>a[0];
		if (a[0]==(-1))
			break;
		else
		{
			while(m>0)
			{
				cin>>a[i];
				if (a[i]==0)
					break;
				m--;
				i++;
			}
			for(j=0;j<=i-1;j++)
				for(k=0;k<=i-1;k++)
				{
					if (a[j]==2*a[k])
						t++;
				}
		}
		cout<<t<<endl;
		t=0;
		m=16;
		i=1;
		n--;
	}
	return 0;
}
//******************************************
//*?????.cpp                         **
//*??: ??     1100012808              **
//*???2011.10.21                       **
//******************************************
int main()           //???
{            //?????
	int a[16] = {0}, i = 1, j = 1, m = 0, k = 0 ;  //??????
	while (cin >> a[0] )           //???????????
	{                                
	    i = 1; j = 1; m = 0; k = 0 ;    //???????
	    if (a[0] != -1)       //????????????-1??????
	    {
		    do   
			{ 
			    cin >> a[i]; //????????a[0]??????
			    i++;
			}while (a[i-1] != 0);   //???????0??????
		    for (j = 0; j <= i - 2; j++) //??????????????
			{
			    for (k = 0; k <= i - 2; k++)
			    {
			        if (a[j] == 2 * a[k]) //?????????
				    m++;    //????????m?1
		             }
			}                            //???for????
		    cout << m << endl;        
	     }        //???if????
		else break;          // ??????????-1?????
	}            //???while??
	return 0;
}           //?????
void main()
{
	int a[15];
	int t,s,i,j,n;
	scanf("%d",&t);
	while (t!=-1)
	{
		s=0;
		n=0;
		a[s]=t;
		scanf("%d",&t);
		while (t!=0)
		{
			s++;
			a[s]=t;
			scanf("%d",&t);
		}
		i=0;
		for (i;i<s;i++)
		{
			j=i+1;
			for (j;j<=s;j++)
			{
				if ((a[i]==a[j]*2)||(a[j]==a[i]*2))
					n++;
			}
		}
		printf("%d",n);
		printf("\n");
		scanf("%d",&t);
	}
}
int main()
{
	int a[16] = {0}, i = 1, num[16] = {0}, s, k = 0;
		while (cin >> s)
		{
			a[i] = s;
			if (a[i] == 0) {i = 0; k++; continue;}
			if (a[i] == -1) break;
			for (int j = 0 ; j <= i ; j++)
			{
				if (a[i] == 2 * a[j] || a[j] == 2 * a[i])
					num[k]++;
			}
		    i++;
		}
		for (i = 0 ; i < k ; i++)
		{
			cout << num[i] <<endl;
		}
	return 0;
}
int main()
{
int an[50],*p,i,t=0,*q;
for(i=0;;)
{
scanf("%d",&an[i]);
if(an[i]==-1) break;
else 
{	
	for(i=1;;i++)

	{
     scanf("%d",&an[i]);
     if(an[i]==0) break;
	}
     for(p=an;*p!=0;p++)
	 {
      for(q=an;*q!=0;q++)
      if(*q==(*p)*2) t++;
	 }
	 printf("%d\n",t);
	 t=0;
}
i=0;

}


return 0;
}
int main()
{
	int n=0,t=0,i,j,x;
	int sz[16];
	for(;;){
	    for(i=0;i<16;i++){
			scanf("%d",&sz[i]);
			if(sz[i]==0||sz[0]==-1)break;
			n=n+1;
		}
		for(i=0;i<n;i++){
	        for(j=0;j<n;j++){
		        if(sz[i]-2*sz[j]==0)
				t=t+1; 
				else;
			}
		}
		if(sz[0]==-1)break;
		printf("%d\n",t);
		t=0;
		n=0;
	}
	return 0; 
	}
int main()
{
	int a[16],b=0,c=0,d=1,e=0;
	scanf("%d",&a[b]);
	while(a[b]!=-1)
	{
		while(a[b]!=0)
		{
			b++;
		    scanf("%d ",&a[b]);
		}
	    while(c<=b)
		{
			while(d<b)
			{
				if(a[c]==(a[d]*2))
					e=e+1;
			    d=d+1;
			}
		    c=c+1;
		    d=0;
		}
	    printf("%d\n",e);
		b=0;
		scanf("\n%d",&a[b]);
		e=0;
		c=0;
	}
	return 0;
}
/*
 * qzlx9.cpp
 *
 *  Created on: 2010-11-17
 *      Author: hanzhe
 */


int main(){                   //????
	int a[16],j;
	while(cin>>a[0]){         //???????
		if(a[0]==-1)break;    //???-1???
		int i=1;
		int l=0;
		while(cin>>a[i]){
			if(a[i]==0)break; //??????0?????
		    for(j=0;j<i;j++)  //??
		    	if((a[i]==2*a[j])||(a[j]==2*a[i]))
		    		l=l+1;
		    i++;
		}
		cout<<l<<endl;
	}
    return 0;
}                              //????
//***************************
//**???1.cpp
//**??????
//**???2013.10.30
//**???????
//***************************
int main()
{
	int a[17], i, n; // ??0????17???
	while (1)
	{
		n = 0;
		cin >> a[1];

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

	for(;;){
		    count=0;
		    for (i=0;i<16;i++){
		               scanf("%d",&A[i]);
		               if(A[i] == 0 ||A[i] == -1)
                       {
                       break;
                       }
	        }
			if(A[i] == -1)
            {
						break;
			}
			for(i=0;i<16;i++){
							if(A[i] == 0)
                            {
								pause=i;
								 break;
							}
			}
			for(k=0;k<pause;k++){
					for(i=0;i<pause;i++){
							if ( A[k] == 2*A[i])/*??2?*/{
								count++;
							}
					}
			}	
			printf("%d\n",count);
	}     
   return 0;
}