semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int a[20];
	int i=0,n=0,j;
	int count=0;
	do
	{
		n=0;
		count=0;
		scanf("%d",&a[0]);
		if(a[0]!=-1)
		{
			i=1;
			do
			{
				scanf("%d",&a[i]);
				i++;
				count++;
			}while(a[i-1]!=0);

			for(i=0;i<count;i++)
			{
				for(j=i+1;j<count;j++)
				{
					if(a[i]==2*a[j] || 2*a[i]==a[j])
					{
						n++;
					}
				}
			}
			printf("%d\n",n);
		}

	}while(a[0]!=-1);
	return 0;
}
int main()
{
	int num[100][100];
	int i=0,j,k=0;
	int line,column[100]={0};
	int tmp,count;
	for(j=0;j<100;j++)
	{
		scanf("%d",&num[i][j]);
		if(num[i][j]==-1) break;
		if(num[i][j]==0)
		{
			i++;j=-1;
		}
		else column[i]++;
	}
	
	line=i-1;
	for(i=0;i<=line;i++)
	{
		tmp=num[i][k];
		count=0;
		for(j=k+1;j<column[i];j++)
		{
			if((tmp*2==num[i][j])||(num[i][j]*2==tmp))
			{
				count++;
			}
			if(j==column[i]-1&&k<column[i]-2)
			{
				k++;
				tmp=num[i][k];
				j=k;
			}
		}
		k=0;
		printf("%d\n",count);
	}
}
int main()
{
	int a[17],b=0,i,j,l,m=0,q;
	for(i=0;i<=16;i++)
         a[i]=0;
	
	for(q=0;;q++)	
	{
		for(i=0;i<16;i++)
		{
		scanf("%d",&a[i]);
		b=b+1;
		if(a[i]==0)
		{
			break;
		}
		}
		if(a[0]==-1)
		{
			goto lab;
		}
	for(j=0;j<b;j++)
		{
		for(l=j+1;l<b;l++)
				{
					if(a[j]==2*a[l]||a[l]==2*a[j])
					{
						m=m+1;
					}
				}
		}
			printf("%d\n",m);
		m=0;
		b=0;
	}
lab:;
}
//************************************************
//* ??????									
//* ????? 2010 11 8
//* ??????????? 
//***********************************************
int main ()
{
	//????
	int a[16];
	while ((cin >> a[0]) && a[0] != -1 )//???????????????
	{
		int num0 = 1, i, j, k, num=0;
		i = 1;
		while(cin >> a[i] && (a[i] != 0))//???????0
		{
			//?????????
			num0 ++;
			i ++;
		}	
		for(j = 0; j < num0 - 1; j ++)//??n-1?
		{
			for(k = j + 1; k <= ( num0 - 1); k ++)//???????????
			{
				if((a[j] == 2 * a[k]) || (2 * a[j] == a[k]))
				num ++;//???????
			}		
		}		
		cout << num << endl;			
	}
	return 0;
}
int main ()
{   int i,j,k,num,a[16],c;
    while (1)
    { i=0;num=0;
    do
        {scanf("%d",&a[i]);c=a[i];i++;}
        while(c!=0&&c!=-1);


        if(a[0]==-1)break;

        for(j=0;j<i-1;j++)
           {for(k=0;k<i-1;k++)
            if(a[j]==2*a[k]) num++;}

            printf("%d\n",num);

    }return 0;
}
int main(int argc, char *argv[])
{
    int i,j,k;     int nowi;    int output;
    int part[20][16];   static int jcount[20], group[20];
    for(i=0; i<20; i++)
    {
        for(j=0; j<16; j++)
        {
           cin >> part[i][j];
           jcount[i]++;
           if(part[i][j]<=0)
           break;
        }
        if(part[i][j]== -1)
           break;
    }
    nowi=i;
    for(i=0; i<nowi; i++)
    {
       for(j=0;j<jcount[i]-1; j++)
       {
          for(k=0; k<jcount[i]-1; k++)
          {
             if( (part[i][j]/part[i][k] ==2) && (part[i][j]%part[i][k] ==0) )
             group[i]++;
          }
       }
    }
    
    for(output=0; output< nowi; output++)
    cout << group[output]<< endl;
    
    
    
    return EXIT_SUCCESS;
}
int main()
{
 int c[100][100];
 int t;
 int n=0;
 int m;
 int d[100]={0};
 int q[100]={0};
 int i;
 int z=0;
 int x=0;
 
 t=0;
 do
 {
  i=0;
  do
  {
   scanf("%d",&c[t][i]);
   if(c[t][0]==-1)
   {break;}
   if(c[t][i]==0)
   {break;}
   i++;d[t]++;
  }while(i<=100);
  if(c[t][0]==-1)
  {break;}
  t++;n++;
 }while(t<=100);
    do
 {
  i=0;
  do
  {
   m=0;
   do
   {
    if((c[z][i]*2)==c[z][m])
    {q[z]++;}
    m++;
   }while(m<=d[z]-1);
   i++;
  }while(i<=d[z]-1);
  z++;
 }while(z<=n-1);
 while(x<=n-1)
 {
  printf("%d\n",q[x]);
  x++;
 }
 scanf("%d",&t);
 return 0;
}
//****************************************
//*?????                          **
//*?????? 1100012920              **
//*???2011.10.119                     **
//****************************************
int main()
{
	int i, k, j, count = 0, a[16];
	 while (a[0] != -1)
	{	
		count = 0;
		for (i = 0; i <= 15; i++)
		{	
		        cin >> a[i];
				if (a[i] == 0 || a[0] == -1)
			       break;
		}
		if (a[0] == -1)
			break;
		for (k = 0; k <= 15; k++)
		{
		   for (j = k + 1; j <= 16; j++)
		   {
			   if(a[j]==0)
				   break;
			   if (a[k] == 2 * a[j] || a[j] == 2 * a[k])
				   count++;
			   }
		}
	    cout << count << endl;
		
	}
	return 0;
}
void main()
{
	int a=16,i,j,k,n=15,b[16],num=0,t=0;
ahead:		for(i=0;i<a;i++)
			{
			scanf("%d",&b[i]);
			t++;
			if(b[i]==0)
			{
				t--;
			    break;
			}
			if(b[i]==-1)
			{
				return;
			}
			else continue;
		}
	    for(i=0;i<t;i++)
		{
		    k=i;
		    for(j=i;j<t;j++)
			{
			    if((b[j+1]-2*b[i]==0)||(b[i]-2*b[j+1]==0))
				{
				    num=num+1;
				}
			    else continue;
			}
		} 		
		printf("%d\n",num);
		num=0;
		t=0;
		goto ahead;
	return;
}
int main()
{
  int N, I, J, Count, Arr[15];
  while (1)
  {
    N = 0;
    while (1)
    {
      cin >> Arr[N];
      if (Arr[N] == -1) return 0;
      if (Arr[N] == 0) break;
      N ++;
    }
    Count = 0;
    for (I = 0; I < N - 1 ; I ++)
      for (J = I + 1; J < N; J ++)
	if (Arr[I] == 2 * Arr[J] || Arr[J] == 2 * Arr[I])
	  Count ++;
    cout << Count << endl;
  }
  return 0;
}
int main()
{   
    int num[15], a, i,x ,k, t;
    cin >> a;
    while(a != -1)
    {
         i = 0;
         x = 0;
         while(a != 0)
         {
            num[i] = a;  
            i = i + 1;
            cin >> a;
         }
         for ( k = 0; k <= i-1; k++)
         {
             for ( t = 0; t <=  i - 1; t++)
             {
                 if ( num[k] == num[t]*2)
                 x = x + 1;
             }
         }
         cout << x << endl;
         cin >> a;
    }
    return 0;
}
int main()
{
    int a[100][15],b[100]={0},i,j,k,s,m=0,x;
    for(i=0;;i++)
  {
    scanf("%d",&a[i][0]);
    if(a[i][0]==-1) break;
    else
    {
      for(j=1;;j++)
      {b[m]++;
        scanf("%d",&a[i][j]);
        if(a[i][j]==0) break;
        else continue;}
        m++;
    }
  }

        for(i=0;i<m;i++)
        {x=0;
        for(j=0;j<b[i];j++)
        {s=0;
        for(k=0;k<b[i];k++)
        {if(a[i][k]*2==a[i][j])
        s=s+1;}
        x=x+s;}
        printf("%d\n",x);
        }

        return 0;
}
//****************************************
//*???   ??                           **
//*??????       **
//*???2011.10.21                         **
//****************************************
int main()
{
    int a[20],k=0,i,w,y,n,p;     //k????
    while(1)
    {
            cin >> p;
            if(p == -1)    //????-1,????? 
                    break;
            else
            {   a[0]=p;
                for(i=1; ;i++)
                {
                        cin >> a[i];
                        if(a[i]==0)
                        {
                                    n=i-1;
                                    break;          
                        }
                }   
                for(w=0;w<=n;w++)
                {
                for(y=0;y<=n;y++)
                {
                         if(a[y]==2*a[w]) 
                         k++;       
                }
                }
                cout << k << endl;
                i=0;
                k=0;
            }
    } 
    return 0;    
}
//***************************************************
//1.cpp ??     ******
//?? ???  1200018209  ********
//?? 2012-10-29 ******
//***************************************************
int main()
{
	int a[100],j,k,l,sum=0;
	for(;;)
	{
		for(j=0;;j++)
		{
			cin >> a[j];
			if(a[j]==0||a[j]==-1)break;
		}
		if(a[0]==-1)break;
		for(k=0;k<j-1;k++)
		{
			for(l=k+1;l<=j-1;l++)
			{
				if(a[k]==2*a[l]||a[l]==2*a[k])
				{
					sum++;
				}
			}
		}
		cout << sum << endl;
		sum=0;
	}
	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;
		}
		
/*	while ((a[i] = cin.get()) != -1)
	{
		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;			//?????????????
		i = 0;
	}
	
	return 0;
}										//?????
int f(int h)
{
	int a[15],i,j,n,m=0;
	a[0]=h;
	if(a[0]==-1)return -1;
	else
	{
		for(i=1;i<=15;i++)
		{
			scanf("%d",&a[i]);
			if(a[i]==0)break;
		}
		n=i;
		for(i=0;i<n;i++)
		{
			for(j=0;j<n;j++)
			{
				if(a[i]==a[j]*2)
				{
					m+=1;
					break;
				}
			}
		}
		return(m);
	}
}
void main()
{
	int a[100],h,i=0;
	while(1)
	{
		scanf("%d",&h);
		a[i]=f(h);
		if(a[i]==-1)break;
		i++;
	}
	printf("%d",a[0]);
	for(i=1;a[i]!=-1;i++)
	{
		printf("\n%d",a[i]);
	}
}
void main()
{
	int a[100][16]={0},b[100]={0},n[100]={0},i,j,k;
	int m=0;
	for(i=0;i<100;i++)
	{
		scanf("%d",&a[i][0]);
		if(a[i][0]==-1)
		{
			break;
		}
		if(a[i][0]!=-1)
		{
            m=m+1;
			n[i]++;
			for(j=1;j<16;j++)
			{
				scanf("%d",&a[i][j]);
				if(a[i][j]!=0)
				{
					n[i]=n[i]+1;
				}
				if(a[i][j]==0)
				{
				    break;	
				}
			}
		}
	}
	for(i=0;i<m;i++)
	{
			for(j=0;j<n[i];j++)
			{
				for(k=0;k<n[i];k++)
				{
					if(a[i][j]==2*a[i][k])
					{
						b[i]=b[i]+1;
					}
				}
			}
		
	}
    for(i=0;i<m;i++)
	{

			printf("%d\n",b[i]);
	}
}
int main()
{   int i,n,a,b,k;
    k=0;
    int sz[20],sz2[20],jieguo[1000];
	while(1){
		for(i=0;;i++){
		 scanf("%d",&(sz[i]));
		 if(sz[i]==0||sz[i]==-1){
		 break;}
		 sz2[i]=sz[i];}
	 	 if(sz[i]==-1){
		 break;}
		 n=0;
		 for(a=0;a<i;a++){
			for(b=0;b<i;b++){
			  if(sz2[b]*2==sz[a]){
				n++;}}}
		 jieguo[k]=n;
		 k++;
	  	}
        for(i=0;i<k;i++){
        printf("%d\n",jieguo[i]);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int num[15],j,k,i,a=0;
	while(1){
		scanf("%d",&num[0]);
		if(num[0]!=-1)
		{
			i=1;
			do{
			scanf("%d",&num[i]);
				i++;
			}while(num[i-1]!=0);
			for(j=0;j<i;j++)
			{
				for(k=j+1;k<i;k++)
				{
					if(num[k]==num[j]*2||num[j]==num[k]*2)
						a++;
				}
			}
			printf("%d\n",a);
			a=0;
		}
		else 
			break;
	}
	
	return 0;

	
}
int main()
{
	int a[20][16],b[20]={0},i=0,j,k=0;
	scanf("%d",&a[0][0]);
	i++;
	while(a[k][0]!=-1)          //input the chunk of data
	{
		do 
		{
			scanf("%d",&a[k][i]);
			i++;
		}
		while(a[k][i-1]!=0);
		k++;
		scanf("%d",&a[k][0]);
		i=1;
	}

	for(k=0;a[k][0]!=-1;k++)
	{
	    for(i=0;a[k][i]!=0;i++)
		{
			for(j=i+1;a[k][j]!=0;j++)
			{
				if((a[k][j]/a[k][i]==2&&a[k][j]%a[k][i]==0)||(a[k][i]/a[k][j]==2&&a[k][i]%a[k][j]==0))//judge double numbers
					b[k]++;
			}
		}
		printf("%d\n",b[k]);
	}
	return 0;
}
/*         1134 ??
??????      2010.11.03     */
int main()
{
	int i, j, l, k, s, t;
	int a[100000] = {0}, b[100000];//b?????????
	for(i = 0; i < 100000; i++)
	{
		cin >> a[i];
		if(a[i] == -1)
			break;
	}
	s = 0;//s????????????
	for(i = 0; i < 100000; i++)
	{
		t = 0;//t????????????
		for(j = 0; j < 10000; j++)
		{
			b[j] = a[s];
			s++;
			if(b[j] == 0)
			{
				for(k = 0; k <= j; k++)
					for(l = k + 1; l <= j; l++)
						if((b[k] == 2 * b[l]) || (b[l] == 2 * b[k]))
							t++;
				cout << t << endl;
				break;
			}
		}
		if(a[s] == -1)
			break;
	}
	return 0;
}
int main()
{	int shuzu[16];
	int  i,t,k,num=0;

	for(i=0;;i++){
		scanf("%d",&shuzu[i]);
		if(shuzu[i]==-1){
			break;
		}
		if(shuzu[i]==0){
		
			for(t=0;t<i;t++){
				for(k=t+1;k<i;k++){
					if(shuzu[t]==shuzu[k]*2||shuzu[t]*2==shuzu[k]){
						num++;
					}

				}
			}
			printf("%d\n",num);
			num=0;
			i=-1;
		}
	
	
	}

	return 0;
}
/*
 * ???: 1000010191_32_9.cpp
 * ??: ???
 * ????: 2010-11-12
 * ??: ??
 */


int main()
{
	int a[17]; //??
	int n,s; //??????????

	while (cin>>a[1],a[1]!=-1)
	{
		n=1;
		s=0;
		while (cin>>a[n+1],a[n+1]!=0) n++;
		for (int i=1;i<=n;i++)
			for (int j=1;j<=n;j++)
				if (a[i]%a[j]==0&&a[i]/a[j]==2)
					s++;
		cout<<s<<endl;
	}
	return 0;
}
main()
{
	int c[16],n,i,j,m,num;
	n=0;
	m=1;
	do
	{
		i=0;
		n=0;
		do
		{
		    scanf("%d",&c[i]);
			i++;
		}while(c[i-1]!=0&&c[0]!=-1&&i<16);
		num=i-1;
		if(c[0]!=-1)
		{
		for(i=0;i<num;i++)
		{
			for(j=i+1;j<num+1;j++)
			{
				if(c[i]>0&&c[j]>0)
				if(c[i]==c[j]*2||c[j]==c[i]*2) n++;
			}
		}
		printf("%d\n",n);
		}
		else m=0;
	}while(m==1);
	return(0);
}
int main()
{
	int i,a[16],m=0,n=0,b,c[200],x=0,y=0;
	for(i=0;i<200;i++)
	{
scanf("%d",&c[i]);
x=x+1;
if(c[i]<0)
i=300;
	}
	for(i=0;i<16;i++,y++)
	{
a[i]=c[y];

if(a[i]>0)
{
for(b=0;b<i;b++)
{
if(a[i]==2*a[b]||a[b]==2*a[i])
m=m+1;
}
}


else if(a[i]==0)
{
	i=-1;
printf("%d\n",m);
m=0;
}


else
i=100;
}
	return 0;
}
int main()
{
    int a[15][16]={{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},c,m;
    for(m=0;m<100;m++)
    {
            for(c=0;c<16;c++)
            {
            scanf("%d",&a[m][c]);
            if(a[m][c]<=0)break;
            }
            if(a[m][0]<=0)break;
            int b,d,e,f=0;
            for(b=0;b<c;b++)
            {
            d=a[m][b]*2;
            for(e=0;e<c;e++)
            {
            if(d==a[m][e])f++;
            }
             }
           printf("%d\n",f);
    }}
//************************
// 6.1.cpp 
// ??  1200018415
// 2012   10 30
//***********************

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

}
int main()
{
    int a[20]={0};
    int j,k,i=0,n=0,m=0;



        while((scanf("%d",&a[i]))&&(a[i]>=0))
        {
        
          if(a[i]==0)
		{
			for(j=0;j<i-1;j++)
			{
				for(k=j+1;k<i;k++)
				if(a[j]==2*a[k]||a[k]==2*a[j])
				m++;
			}
			printf("%d\n",m);
			m=0;
			i=0;
			for(j=0;j<20;j++)
			a[j]=0;
		}
    i++;


        }



    return 0;
}
// ???:??
// ??:????
// ????:2011.10.25
int main()
{
	int a[16], i, j, temp, count ;
	i=0;
	while (cin>>a[0])
	{
		count=0;
		if (a [0] == -1)
			break;
        i=1;
		while (cin >> a [i])
		{
			if (a [i] < 1)
			{
				temp = i;
				break;
			}
			i ++;
		}
		for (i = 0; i < temp - 1; i ++)
		{
			for (j = i + 1; j < temp ; j ++)
			{
				if (a [i] == 2 * a [j] || a [j] == 2 * a [i])
				{
					
					count ++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}
//********************************
//*????1.cpp   **
//*?????? 1300012966 **
//*???2013.10.30  **
//*?????   **
//********************************
int main()
{
	int a[17], i, j, k, n;
	cin >> a[1];
	while (a[1] != -1)
	{
		n = 0;
		i = 1;
		while (a[i] != 0)
		{
			i++;
			cin >> a[i];
		}
		for (j = 1; j <= i; j++)
		{
			for (k = 1; k <= i; k++)
			{
				if (a[j] == a[k] * 2)
				{
					n++;
				}
			}
		}
		n = n - 1;
		cout << n << endl;
		cin >> a[1];
	}
	return 0;
}
int main()
 {
	 int i,j,a[16],b[100],changdu=0,panduan=1,geshu=0;
	 while(1){
		 for(i=0;i<16;i++){
			 scanf("%d",&a[i]);
			 changdu=i;
			 if(a[i]==-1){
				 panduan=0;
				 break;
			 }
			 if(a[i]==0){
				 break;
			 }
		 }


		 if(panduan==0)
			 break;
		 


		 geshu=0;
		 
		 for(i=0;i<changdu;i++){	 
			 for(j=0;j<changdu;j++){
				 if(a[i]==a[j]*2){
					 geshu++;
				 }			 
			 }
		 }		 

		 printf("%d\n",geshu);
	 }
 

   return 0;
}
int main()
{
	double a[15] , num , cnt   ;
	int i;
	for(int n = 0 ; n <= 99999 ; n++)
	{
		cnt = 0;
		for( i = 0 ; i <= 15 ; i++)
		{
			cin >> num;
			if(num == 0)break;
			else 
				a[i] = num;
		}
		if(a[0] == -1)break;
		else
		{
			for(int j = 0 ; j <= i - 1 ; j++)
				for(int k = 0 ; k <= i - 1 ; k++)
					if(a[j] == 2 * a[k])
						cnt++;
		}
		cout << cnt << endl;
		
	}
	return 0;
}
int main()
{
	int shuru[20] = {0};
	
	while (true)
	{
		int i = 1 , j , k , s , no;
		s=0;
		cin>>shuru[0];
		if(shuru[0]==-1)
			break;

		for(i=1;i<=15;i++)
		{
			cin>>shuru[i];
			if(shuru[i]==0)
				break;
			for(j=0;j<i;j++)
				if((shuru[j]==2*shuru[i])||(2*shuru[j]==shuru[i]))
					s++;
		}
		//cout << "yes  " << shuru[0] << endl;
		cout<<s<<endl;
		for(i=0;i<=14;i++)
		shuru[i]=0;
	}
	return 0;
}
int main()
{
	int a[16],i,j,k,l;
	do
	{
		i = 0;
		l = -1;
	    for(j = 0;j <= 15;j++)
    		a[j]=1;
    	do
		{
    		cin >> a[i];
    		i++;
			    if(a[0] == -1)
    		        break;
		}while(a[i-1]!=0);
    	if(a[0] == -1)
    		break;
    	for(j = 0;j <= i-1;j++)
		{
		    for(k = 0;k <= i-1;k++)
			{
		    	if(a[j] == 2 * a[k])
		    		l++;
			}
		}
	    cout << l << endl;}while(a[0]!=-1);
	return 0;
}
int main()
{
	int a[15],i;
	while(1)
	{
		int n=1,sum=0,j;
		cin >> a[0];
		if (a[0] == -1)
			break;
		while(cin >> a[n])
		{
			if (a[n] == 0)
				break;
			n++;
		}
		for (i=0; i < n-1; i++)
		{
			for (j = i + 1; j < n; j++)
			{
				if (a[i] == a[j] * 2 || a[j] == a[i] * 2)
					sum++;
			}
		}
		cout << sum << endl;
	}
	return 0;
}
int main()
{
	int a[100][16], i, j, k, t;
	for(i = 0; ; i++)
	{
		scanf("%d", &a[i][0]);
		if(a[i][0] == -1)
			break;
		for(j = 1; a[i][j - 1] != 0; j++)
		{
			scanf("%d", &a[i][j]);
		}
	}
	for(j = 0; j < i; j++)
	{
		int n = 0;
		for(k = 0; a[j][k + 1] != 0; k++)
		{
			for(t = k + 1; a[j][t] != 0; t++)
			{
				if(a[j][k] == 2 * a[j][t] || a[j][t] == 2 * a[j][k])
					n++;
			}
		}
		printf("%d\n", n);
	}
	return 0;
}
main()
{
 int a[100][16];
 int z[100]={0};
 int i,j,s,m=0;
 for(i=0;;i++)
 {
	 for(j=0;;j++)
	 {
		 scanf("%d",&a[i][j]);
	     if(a[i][j]==0)
		    break;
		 if(a[i][j]==-1)
		 goto loop;
	 }
 }
loop:for(i=0;a[i][0]!=-1;i++)
 {
	 for(j=0;a[i][j]!=0;j++)
	 {
		 for(s=0;a[i][s]!=0;s++)
			 if(a[i][j]==2*a[i][s])
	           z[i]++;
	 }
	 printf("%d\n",z[i]);
 }
}
int main()
{
	int a[15];
	int i = 0 ;
	while(cin >> a[i])
	{
		int i = 0,j = 0;
		if(a[i] == -1)return 0;
		do
		{
			i++;
			j++;
			cin >> a[i];
		}   while(a[i]);
	
		
			int y, z, k = 0;
			 for(z=0; z <= j - 1; z++)
				for(y = z + 1; y <= j - 1; y++)
					if(a[z] == 2 * a[y] || a[y] == 2 * a[z]) 
					{
						k++;
					}
			cout << k <<endl;
		

	}	
    
	return 0;
}
//****************************************************** 
/* ? ? ?   ???
/* ? ?      ????                           
/* ? ? ? ??2010 ? 11  ?  7  ?     
/* ? ? ? ??????????????????????????????????????
/* ? ?      ?1000012752        
*******************************************************/ 
int main()                                  
{
    int a[16];
	int i,j,k;
	int count;

    end3:;
	for(i=0 ;  ; i++)									//????a[i]
	{
        count = 0;
        cin >> a[i];
		if(a[i] == -1)									//????-1?????
		{goto end1;}
		if(a[i] == 0)									//????0???????????
		{
			for(j=0 ; j<i ; j++)						//??????j?k???????????
			{
				for(k=0 ; k<i ; k++)
                {
					 if(a[j] == 2*a[k])					//???2?????????????+1
					 {
						 count = count+1;
						 break;
					 }
				}
			}
			cout << count << endl;
			goto end3;									//??????a[i]
		}

	}
end1:;
                  
    return 0;
}
int main(){
	float sz[16];
	int n[100];
	int i,k;
	for(i=0;i>=0;i++){
		n[i]=0;
		for(k=0;k<16;k++){
			scanf("%f",&sz[k]);
			if(sz[k]==0||sz[0]==-1)
				break;
		}
		for(int a=0;a<k-1;a++){
			for(int b=a+1;b<k;b++){
				if(sz[a]==sz[b]*2||sz[a]==sz[b]/2){
				n[i]++;
				}
			}
		}
		if(sz[0]==-1)
			break;
	}
	for (k=0;k<i;k++)
		printf("%d\n",n[k]);
	return 0;
}
void main()
{
	int a[15],b[20],i,l,j,n,p=0,num=0;
	while(1)
	{   	num=0;
		scanf("%d",&n);
		if(n==-1)break;
		else
		{
            a[0]=n;
		for(l=1;;l++)
		{
			scanf("%d",&a[l]);
			if(a[l]==0)break;
		}
        for(i=0;a[i]!=0;i++)
			for(j=0;a[j]!=0;j++)
	        {
              if(a[i]==a[j]*2)num++;
			}
		b[p]=num;
		p++;
		}
	}
	for(i=0;i<p;i++)printf("%d\n",b[i]);
}
int main()
{
   int x[16],i,j,k;
   for(i=0;i<15;i++)
	   x[i]=0;
   for(i=0;;i++)
   {
	   cin>>x[i];
	   if(x[i]==-1)
		   break;
	   if(x[i]==0)
	   {
           int t=0;
		   for(j=0;j<i;j++)
			   for(k=0;k<i;k++)
				   if(x[j]==2*x[k])
				   {
                        t++;
				   }
           cout<<t<<endl;
		   i=-1;
	   }
   }
   return 0;
}
int main()
{
    int n,a[16][16],i,j,t[15]={0},k=0,f,b[16]={0};
    for(i=0;i<=10;i++)
    {
      for(j=0;j<=15;j++)
        {
          scanf("%d",&a[i][j]);
          if(a[i][j]==-1) break;
          if(a[i][j]==0) 
          break;
          t[i]=t[i]+1;
        } 
       if(a[i][j]==-1) break;
         k=k+1;
       }
     for(i=0;i<k;i++)
      {
        for(j=0;j<t[i];j++)
        {
          for(f=j+1;f<=t[i];f++)
          {
            if((a[i][j]==2*a[i][f])||(a[i][f]==2*a[i][j]))
              b[i]++;
          }
        }
      }  
      for(i=0;i<k;i++)
      printf("%d\n",b[i]);
      return 0;
}
//?? 
int main()
{
    int num[16];    //???????????? 
    int i, k, n;   //i,k????  n????? 
    while (1)      //?while?????break???-1 
    {
        memset(num, 0, sizeof(num));
        i=0;
        k=0;
        n=0;    //????? 
        for (i = 1; ; i++)
        {
            cin >> num[i];
            if (num[i] == 0) break;
            for (k = 1; k <= i; k++)
            {
                if ((num[k] / num[i]==2 && num[k] % num[i] == 0) || 
                    (num[i] / num[k]==2 && num[i] % num[k] == 0))  n++;   //???? 
            }
        }
        if (num[1] == -1) break;
        cout << n << endl;
    }
    return 0;
}
void main()
{
int i,j,l,m=0,c[100][100],f[100]={0};
for(j=1;;j++)
{
  scanf("%d",&c[j][1]);
  if(c[j][1]==-1) break;
  for(i=2;;i++)
   {
    scanf("%d",&c[j][i]);
   if(c[j][i]==0) break;
   for(l=i;l>=1;l--)
   if(c[j][l]==2*c[j][i]||c[j][i]==2*c[j][l]) f[j]++;
   }
 m++;
}
for(j=1;j<=m;j++)
printf("%d\n",f[j]);
}
main()
{
 int a[100][16];
 int z[100]={0};
 int i,j,s,m=0;
 for(i=0;;i++)
 {
	 for(j=0;;j++)
	 {
		 scanf("%d",&a[i][j]);
	     if(a[i][j]==0)
		    break;
		 if(a[i][j]==-1)
		 goto loop;
	 }
 }
loop:for(i=0;a[i][0]!=-1;i++)
 {
	 for(j=0;a[i][j]!=0;j++)
	 {
		 for(s=j+1;a[i][s]!=0;s++)
		 {
			 if(a[i][j]==2*a[i][s])
	           z[i]++;
			 if(a[i][j]*2==a[i][s])
				 z[i]++;
		 }
	 }
	 printf("%d\n",z[i]);
 }
}
int main()
{
	int row,col;
	int a,b;
	int sz[100][100];
	int sum[100];
		
	for(row=0;row<100;row++)
	{
		sum[row]=0;
	}
	
	for(row=0;row<100;row++)
	{
		for(col=0;col<100;col++)
		{
			scanf("%d",&sz[row][col]);
			if(sz[row][col]==0)
			{
				break;
			}
			if(sz[row][0]==-1)
			{
				break;
			}
		}
		if(sz[row][0]==-1)
		{
			break;
		}
		a=row;
	}
	
	for(row=0;row<=a;row++)
	{
		for(b=0;b<100;b++)
		{
			for(col=0;col<100;col++)
			{
				if(sz[row][b]==2*sz[row][col]&&sz[row][b]!=0&&sz[row][col]!=0)
				{
					sum[row]++;
				}
			}
		}
	}
	
	for(row=0;row<=a;row++)
	{
		printf("%d\n",sum[row]);
	}
	
	return 0;
}
void main()
{
	int k,i,j,n,m;
	int a[15];
	scanf("%d",&k);
	while(k!=-1)
	{
        n=0;
		m=0;
		i=0;
		while(k!=0)
		{
			n++;
			a[i]=k;
			i++;
			scanf("%d",&k);
		}
		for(i=0;i<n;i++)
			for(j=i+1;j<n;j++)
			{
				if(a[i]==2*a[j]||a[j]==2*a[i])
				{
					m++;
				}
			}
		printf("%d\n",m);
		scanf("%d",&k);
	}
}
int main()
{
    int i,j,t,a[16]={0},sum=0,k=0;
    while(scanf("%d",&a[0]) && a[0]!=-1){
    for(i=1;i<=16;i++){
        scanf("%d",&a[i]);
        if(a[i]!=0) sum++;
        else break;
    }
    for(i=0;i<=sum;i++){
        for(j=i+1;j<=sum;j++){
            if(a[i]==2*a[j] || a[j]==a[i]*2) k++;
        }
    }
    printf("%d\n",k);
    sum=0;
    k=0;
    }
    return 0;
}