semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int m,i,j,k,key,num;
	key=0;
	int count[100];
	int a[100][156];
	int result[100];
	for(i=0;i<100;i++)
	{
		for(j=0;j<16;j++)
		{
			scanf("%d",&m);
			if(m==0)
			{
				break;
			}
			else if(m==-1)
			{
				key=1;
				break;
			}
			else
			{
				a[i][j]=m;
				count[i]=j;
			}
		}
		if(key==1)
		{
			break;
		}
		num=i;
	}
	for(i=0;i<=num;i++)
		result[i]=0;
	for(i=0;i<=num;i++)
	{
		for(j=0;j<=count[i];j++)
		{
			for(k=0;k<=count[i];k++)
			{
				if(a[i][j]==a[i][k]*2)
				    result[i]=result[i]+1;
			}
		}
	}
	for(i=0;i<=num;i++)
	{
		printf("%d\n",result[i]);
	}
	return 0;
}
//********************************
//*??????                 **
//*??????  1000012939     **
//*???2012.11.02             **
//********************************
int main()
{
	int a[16];
	while (cin >> a[0] && a[0] != -1)
	{
		int n = 0, count = 0;
		while (a[n] != 0)
			cin >> a[++n];
		for (int i = 0; i < n; i++)
		{
			for (int j = i; j < n; j++)
				if (a[i] == 2 * a[j] || a[j] == 2 * a[i])
					count++;
		}
		cout << count << endl;
	}
	return 0;
}
int main()
{
   int num[20],i,j,n,c,t;
   do
   {
     scanf("%d",&c);
	 num[0]=c;
	 n=1;
	 while(c!=0)
	 {
	   scanf("%d",&c);
	   if(c==-1) return 0;
	   num[n]=c;
	   n++;
	 }
	 t=0;
	 for(i=n-2;i>=0;i--)
	  for(j=n-2;j>=0;j--)
	   if(num[i]==2*num[j])
	    t++;
	 printf("%d\n",t);
   }while(c!=-1);
   return 0;
}
int main()
{
	int x[100][16];
	int sum[100]={0};
	float y;
	int i,j,k;
	for(j=0;j<100;j++)
	{
	    for(i=0;i<16;i++)
		{
		    scanf("%d",&x[j][i]);
	            if(x[j][0]==-1)
			        goto loop;
			    if(x[j][i]==0)
					break;
		}
	}
loop:for(j=0;j<100;j++)
	{
			if(x[j][0]!=-1)
			{
		    for(i=0;i<16;i++)
			{
			    if(x[j][i]==0)
				    break;
		    	for(k=0;k<16;k++)
				{
				if(x[j][k]==0)
			     	break;
                y=1.0*x[j][i]/(1.0*x[j][k]);
				if(y==2)
					sum[j]=sum[j]+1;
				}
			}
		    printf("%d\n",sum[j]);
			}
	if(x[j][0]==-1)
		    	break;

	}
	return 0;
}
void main()
{
   int a[15][17],i,num,j,k,l,h;
   scanf("%d",&a[0][0]);
   for(j=0;j<=15&&a[j][0]!=-1;j++)
   {for(i=1;i<=15&&a[j][i-1]!=0;i++)
 scanf("%d",&a[j][i]);
 scanf("%d",&a[j+1][0]); }
   for(l=0;l<=14&&a[l][0]!=-1;l++)
   {num=0;
   for(k=0;k<=15&&a[l][k]!=0;k++)
   {for(h=0;h<=15&&a[l][h]!=0;h++)
   {if(a[l][k]==2*a[l][h]) num++;}}
   printf("%d\n",num);}
}
int main()
{
 int i, num, s, a[101];
 while(1)
 {
   scanf("%d",&s);
   if(s==-1) break;
   num=0;
   for(i=0;i<101;i++)
     a[i]=0;
   a[s]=1;
   while(scanf("%d",&s)==1&&s!=0)
     a[s] = 1;
   for(i=0;i<50;i++)
    if(a[i]==1&&a[2*i]==1)
     num++;
     printf("%d\n",num);
 }
  return 0;
}
/*1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
*/





int main()
{
	int a[100];
	int i=1,count=0;
	scanf("%d",&a[0]);
	while (a[i-1]!=0)
	{
		scanf("%d",&a[i]);
		i++;
	}
	i=i-2;
	while (a[0]!=-1)
	{
		count=0;
		int j,k=0;
		for(j=0;j<i;j++)
		{
			for(k=j+1;k<i;k++)
			{
				if(a[k]==2*a[j]||a[j]==2*a[k])
				{
					count++;
				}
			}
		}
		printf("%d\n",count);
		scanf("%d",&a[0]);
		if(a[0]==-1)
		{
			break;
		}
		i=1;
	   while (a[i-1]!=0)
	   {
		scanf("%d",&a[i]);
		i++;
	   }
	    i=i-1;
		
	}
	return 0;
	
}
int main()
{
	int sc[300],ao[16];
	int i,j,k,l,n,b,x,m;
	i=0;j=0;k=0;l=0,x=0;
	do{
		n=1;
	    for(i=0;i<16;i++){
		scanf("%d",&ao[i]);
		if(ao[i]==0||ao[i]==-1){
			n=i;
			break;
		}
	}
	i=0;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(ao[i]*2==ao[j]){
				 k++;
			}
		}
	}
    sc[l]=k;
	k=0;
	l++;
	}
	while(n!=0);
	for(x=0;x<l-1;x++){
		printf("%d\n",sc[x]);
	}
	return 0;
}
/*
	file 1134??
    name ???
	date 11.5
	function ??2?15????????????????????????????????????????????
*/
int main()
{
	int a[16], sum = 0, i, j, n = 0;
	while(1)
	{
		for(i = 0; i < 16; i++)
		{
			cin >> a[i];
			if(a[i] == 0)
			{
				break;
			}
			else if(a[i] == -1)
			{
				break;
			}
			else
			{
				n++;
			}
		}
		if(a[0] == -1)
		{
			break;
		}
		for(i = 0; i < n; i++)
		{
			for(j = 0; j < n; j++)
			{
				if(a[i] == a[j] * 2)
				{
					sum++;
				}
			}
		}
		cout << sum << endl;
		n = 0; sum = 0;
	}
	return 0;
}
//this program helps you to find how many pairs of numbers satisfy the standard that the one is double of the other
int main()
{
	int a[20],bn[100]={0,0,0},i,j,k,t=1,l;//bn is the number of double

	for(t=1;;t++)
	{
		i=1;
		do
		{                            //this loop is aimed at inputting the t group of numbers
			scanf("%d",&a[i-1]);
			if(a[i-1]==-1)break;
			i++;	
		}while(a[i-2]!=0);
		if(a[i-1]==-1)break;
		for(j=1;j<=i-2;j++)        //this loop is aimed at check the sequence one by one
		{
			for(k=1;k<=i-2;k++)  //realize the checking
				if(a[j-1]==2*a[k-1])bn[t-1]++;
		}
	}
	for(l=1;l<=t-1;l++)
		printf("%d\n",bn[l-1]);
	return 0;
}
int main()
{
    int i,j,k,a[100][16],K,I,b[100]={0};
    for(i=0; ;i++)
    {
        scanf("%d",&a[i][0]);
        if(a[i][0]==-1) break;
        for(j=1; ;j++)
        {
            scanf("%d",&a[i][j]);
            if(a[i][j]==0) break;
        }
        for(k=0;k<=j-1;k++)
        {
            for(K=0;K<=j-1;K++)
            {
                if(a[i][K]==2*a[i][k]) b[i]++;
            }
        }
    }
    for(I=0;I<i;I++)
    printf("%d\n",b[I]);
    return 0;
}
int a[16]={0},k;
void scan();

void main()

{
	scanf("%d",&a[0]);
	while(a[0]>0)
	{
		scan();
		scanf("%d",&a[0]);
	}
}
void scan()
{
	
    int i,j=1,n=0,h,t;
	while(scanf("%d",&a[j])&&a[j]!=0)
	{
		j++;
	}
    for(i=0;i<j;i++)
	{
	    for(h=i;h<j;h++)
		{
			if(a[i]>a[h])
			{
				t=a[i];
				a[i]=a[h];
				a[h]=t;
			}
		}
	}
    for(i=0;i<j-1;i++)
	{
		for(h=i+1;h<j;h++)
		{
			if(a[h]==2*a[i])
			{
			n++;
	        break;
			}
		}
	}
		printf("%d\n",n);
}
int main()
{
	int a[500][15];
	int i,j,t,number;
	for(i=0;;i++){
		number=0;
		scanf("%d",&a[i][0]);
		if(a[i][0]==-1){
			break;
		}
		for(j=1;;j++){
			scanf("%d",&a[i][j]);
			if(a[i][j]==0){
				printf("%d\n",number);
				break;
			}
			for(t=0;t<j;t++){
				if(a[i][j]*2==a[i][t]){
					number++;
					break;
				}
				if(a[i][j]==a[i][t]*2){
					number++;
				}
			}
		}
	}
	return 0;
}
int main()
{
    int a[16];
    int i,j,num;
    while(1)
    {
        for(i=0;i<16;i++)
        {
	   cin>>a[i];
            if(a[0]==-1)
                return 0;
            if(a[i]==0)
                break;
        }
        num=0;
        for(i=0;a[i];i++)
            for(j=0;a[j];j++)
                if(a[i]==2*(a[j]))
                    num++;
		cout<<num<<endl;
    }
    return 0;
}
/*
 * 1000010175_mte9.cpp
 *
 *  Created on: 2010-11-14
 *      Author: ???
 *      function:1134 ??
 */



int main(){
	int iNum[20],i,j,n,iPair;
	while(1)
	{
		iPair=0;
		memset(iNum,0,80);
		cin>>iNum[0];
		n=1;
		if(iNum[0]==-1) break;
		do                 //??,????0???
		{
			cin>>iNum[n];
			n++;
		}while(iNum[n-1]!=0);
		n--;    //????0????

		for(i=0;i<n;i++)  //????,???????????
			for(j=0;j<n;j++)
				if(iNum[j]==iNum[i]*2)
					iPair++;
		cout<<iPair<<endl;
	}
	return 0;
}
int main()
{
 int a[16], b, i = 0, k;
 while (1)
 {
  b = 0;
  int a[16] = {0};
  for ( i = 0 ; i <= 15 ; i++ )
  {   
   cin >> a[i];
   if (( a[i] == 0 ) || ( a[i] == -1 ))
    break;
    for ( k = 0 ; k < i ; k++ )
    {
     if (( a[i] == 2 * a[k] ) || ( a[i] == 0.5 *a[k]))
      b++;
    }
   }
    if ( a[i] == -1 )
     break;
    cout << b <<endl;
  }
  return 0;
}
int main()
{
	int num[15], i, j, k, t, N;
	for(i=1 ; ; i++)
	{
		cin >> num[0];
		if(num[0] == -1)
			break;
		N=0;
		for(j=1; ; j++)
		{
			cin >> num[j];
			if(num[j] == 0)
				break;
		}
		for(k=0; k<=j-1; k++)
		{
			for(t=0; t<=j-1; t++)
			{
				if(num[k] == 2*num[t])
					N++;
			}
		}
		cout << N << endl;
		
	}
	
	return 0;
}
int main()
{
    int i, j, a[20], sum = 0;                   //??????????????????????
    while (1)
    {
        cin >> a[0];                            //??????
        if(a[0] == -1) break;                   //?????-1????????
        for(i = 1; a[i - 1] != 0; i++)          //???????????0??
        {
            cin >> a[i];
        }
        for(i = 0; a[i] != 0; i++)
        {
            for(j = 0; a[j] != 0;j++)
            {
                if(a[i] == 2 * a[j])            //???????????sum??
                    sum++;
            }
        }
    cout << sum << endl;                        //????????
    sum = 0;                                    //?sum??
    }
    return 0;
}
int main()
{
	int sz[16],result[100];
	int i,j,k,n=0,row=0;
	while(1){
		for(i=1;i<16;i++){
			sz[i]=0;
		}
		scanf("%d",&sz[0]);
		if(sz[0]==-1){
			break;
		}else{
			k=1;
			for(i=1;i<16;i++){
				scanf("%d",&sz[i]);
					if(sz[i]==0){
						break;
					}else{
						k++;
					}
			}
			n=0;
			for(i=1;i<k;i++){
				for(j=0;j<i;j++){
					if(sz[i]==sz[j]*2||sz[j]==sz[i]*2){
						n++;
					}
				}
			}
			result[row]=n;		
			row++;
		}
	}
	for(i=0;i<row;i++){
		printf("%d\n",result[i]);
	}
	return 0;
}
void main()
{
	int a[MAX][16],b[MAX]={0,0};
	int i,j,k,h,m;
	int count1,count2;
	count2=-1;
	for(i=0;i<MAX;i++)
	{
		count1=-1;
		for(j=0;j<16;j++)
		{
			scanf("%d",&a[i][j]);
			if((a[i][j]==0)||(a[i][j]==-1))
				break;
			count1++;
		}
		if(a[i][j]==-1)
			break;
		for(k=0;k<=count1;k++)
		{
			for(h=0;h<=count1;h++)
			{
				if(a[i][k]==2*a[i][h])
					b[i]++;
				else
					continue;
			}
		}
		count2++;
	}
	for(m=0;m<=count2;m++)
		printf("%d\n",b[m]);
}
int main()
{ 
	int a,i,j,k,h;
	int b[16]={0};
   while(1)
   {
	   i=0;
	  while(cin>>a)
		{
		  if(a==(-1))
				return 0;
		  else
		  {	
			  if(a!=0)
				{
					b[i]=a;
					i++;
				}
		        else
					break;
		  }
		}
		h=0;
	
		for(j=0;j<=i-1;j++)
			{
				if(b[j]!=0)
				{	
					for(k=0;k<=i-1;k++)
					{
						if(b[j]==b[k]*2)
						h++;
					}
				}
				else
					 break;
				
			}
			cout<<h<<endl;
	}
   	 return 0;
}
int main(){
int a[15];
while(cin)
{int temp,num=0,i=0,j=0,k=0;
 for(i=0;cin>>a[i];i++)
 if(a[i]==-1)
 return 0;
 else if(a[i]==0)
{for(j=1;j<i;j++)
 for(k=0;k<i-j;k++)
 if(a[k]>a[k+1])
 {temp=a[k];
 a[k]=a[k+1];
 a[k+1]=temp;
 }
for(j=0;j<i;j++)
for(k=j+1;k<i;k++)
if(a[j]*2==a[k])
num++;
cout<<num<<endl;
num=0;
break;}
}

}
//*******************************
//????1.cpp                 *
//????? 1? 1200012895     *
//???2012?10?29?          *
//??????????????  *
//*******************************
int main()
{
	int x, a[16], i, j, n = 0, num= 0, m;        //x????????????a[]?x????i?j??????n????????
	                                             //num???????????m????????
	while (1)     
	{
        cin >> m;                        
		if (m == -1)                             //?????-1?????
			break;
		else
		{
			a[1] = m;                            //??????????????????1
		    n = 1;
		}
		for(i = 2; ; i++)
		{ 
			cin >> x;                            //??????????????0?????????????1
	        if (x == 0)
			     break;
	    	else
			{
			     a[i] = x;
	             n = n + 1;
			}
		}
	    for (i = 1; i <= n; i++)                 //????????????????????????1
		{
		    for (j = 1; j <= n; j++)
			{
		    	if (a[i] == (2 * a[j]))
			    	num = num + 1;
			}
		}
    	cout << num << endl;                     //???????????
		num = 0;
	}
	return 0;
}
/*
 * 1000012761_xiaoceyan9.cpp
 *??2?15????????????????????????????????????????????

????1 4 3 2 9 7 18 22???????3???2?1????4?2????18?9????
 *  Created on: 2010-11-16
 *      Author: 378073652
 */


int main(){
	int a[20][20],i,j,b[20],s,n=0,k;
	for(i=0;i<20;i++){
		for(j=0;j<16;j++){
			cin>>a[i][j];
			if(a[i][0]==-1) break;
			if(a[i][j]==0){ b[i]=j;break;}

		}

		if(a[i][0]==-1) break;
	}
	s=i;
	for(i=0;i<s;i++){
		for(j=0;j<b[i];j++){
			for( k=j+1;k<b[i];k++){
				if(((a[i][j]%a[i][k]==0)&&(a[i][j]/a[i][k]==2))||((a[i][k]%a[i][j]==0)&&(a[i][k]/a[i][j]==2)))
					n=n+1;
			}
		}
		cout<<n<<endl;
		n=0;
	}

	return 0;
}
int main()
{
	int i,j,k,sum,e=0;
	int a[20];
	for(;;)
	{
	
		sum=0;
		for(i=0;;i++)
		{
			cin>>a[i];
			if(a[i]==0)
			{
				i--;
				break;
			}
			else if(a[i]==-1) {e=-1; break;}
		}
		if(e==-1) break;
		for(j=0;j<=i;j++)
		{
			for(k=0;k<=i;k++)
			{
				if(a[k]==a[j]*2)
				{
					sum++;break;
				}
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}
int main()
{
	int sz[16],i,a,num=0,no=0,j;
	while(1)
	{
		scanf("%d",&a);
			if(a==-1)
				return 0;
			else if(a>0)
			{
				sz[no]=a;
				no++;
			}
			else if(a==0)
			{
				for(i=0;i<no;i++)
				{
				
					for(j=0;j<no;j++)
					if(sz[i]==2*sz[j])
					num++;
				}
			
			printf("%d\n",num);
			no=0;
			num=0;


			}
	}

	return 0;

}
int main()
{ int a[2000];
int i,m,n,k,lt;
k=0;
lt=0;
for (i=0;i<2000;i ++)
{cin>>a[i];
if (a[i]==-1)
	break;
if (a[i]==0)
	{for(m=lt;m<i;m++)
	   {for (n=lt;n<i;n++)
	     {if (a[m]==2*a[n])
{k++;}
}
}
            cout<<k<<endl;
	   k=0;
            lt=i+1;
}
}
return 0;
}
main()
{
	int i,j,k,num=0,tot,a[16],b[1000];
	do
	{
		i=0;
		tot=0;
		do
		{
			scanf("%d",&a[i]);
			i++;
		}
		while (a[i-1]>0);
		if (a[0]!=-1)
		{
			for (j=0;j<=i-3;j++)
				for (k=j+1;k<=i-2;k++)
					if (a[j]==2*a[k]||a[k]==2*a[j]) tot++;
		    b[num]=tot;
		    num++;
		}
	}
	while (a[0]!=-1);
	for (i=0;i<num;i++)
		printf("%d\n",b[i]);
	return 0;
}
int main()
{
	int a[300],i,n,k,j;
	for(i=0;i<=300;i++)
	{
	scanf("%d",&a[i]);
	if(a[i]==-1) break;
	}
	for(k=0;k<=300;k++)
	{
		if(a[k]==-1)break;
		if(a[k-1]==0||k==0)
		{
			n=0;
			for(i=k;a[i]!=0;i++)
			{
				
		for(j=i;a[j]!=0;j++)
		{
			if(a[i]==2*a[j]||a[j]==2*a[i]) n=n+1;
		}
			}
			printf("%d\n",n);
		}
	}
}
//***************************
//*?????              **
//*?????? 1300013007 **
//*???2013.10.30        **
//***************************
int main()
{
	int k, i, m=0, number;
	double a[15];
	do
	{
		cin >> number;
		if(number == -1)
			break;
		else
			a[0] = number;
		for(i=2; ; i++)
		{
		    cin >> number;
	    	a[i-1] = number;
	        for(k=0; k<i-1; k++)
			{
			    if(a[i-1] == (2 * a[k]) || a[i-1] == (a[k] / 2))
				    m++;
			}
		    if(number==0)
			{ 
			    cout << endl << m << endl;
			    break;
			} 
		}
		m = 0;
	}while(1);
	return 0;
}
int iFind(int *p, int findnum)
{
	int k, sum = 0;
	for (k = 0; k < 15; k++)
	{
		if (*(p + k) == findnum)
			sum ++;
	}
	return sum;
}


int main()
{
	int a[15], temp, i = 0, j, k, *p, sum = 0;
	p = a;
	for (j = 0; j < 15; j++)
		a[j] = -1;
	while (cin >> temp, temp != -1)
	{
		if (temp != 0)
		{
			a[i] = temp;
			i++;
		}
		else
		{
			for (k = 0; k < 15; k++)
			{
				sum += iFind(p, a[k] * 2);
			}
			cout << sum << endl;
			sum = 0;
			i = 0;
			for (j = 0; j < 15; j++)
				a[j] = -1;
		}
	}
	return 0;
}
/**
* file homwork.cpp
* author ??? 1100012722
* data 2011-10-20
* description ??
*/ 
int main()
{
 int a[20] , b[20] ;
 int i , j , k ;
 int n ;
 i = 1 ; n = 0 ;
 
 while( 1 )             // ??????
  {
   scanf("%d",&a[i]);
   if( a[i] == -1 )  break;     // ??-1???????
   else if( a[i] == 0 )         // ??0???????
     {
       for(j = 1 ; j <= i-1 ; j++)
	  b[j] = a[j] * 2;

       for(j = 1 ; j <= i-1 ; j++)
	  for(k = 1 ; k <= i-1 ; k++)
	    {
	     if( b[j] == a[k] ) n++;
	    }
		
       printf("%d\n",n);
       i = 1;
       n = 0;                // ?????????
     }
   else i ++;                // ?0?-1????
  } 
  return 0;
}
int main ()
{
	int array[15];
	int i,j,temp,min,flag,twice;
	for(;;)
	{

	for(i=0;i<15;i++)
		array[i]=0;
	for(i=0;;i++)
	{
		scanf("%d", &temp);
		if(temp==-1)
			return 0;
		if(temp==0)
			break;
		array[i]=temp;
	}
    // ??
    for(i=0;i<15;i++)
	{
			min=array[i];
			for(j=i+1;j<15;j++)
			{
				if(array[j]<min)
				{
					temp=min;
					min=array[j];
					array[j]=temp;
				}
			}
			array[i]=min;
	}
	//?????????
	for(flag=0,i=0;i<15;i++)
	{
        if(array[i]==0)
			continue;
		twice=array[i]*2;
		for(j=i+1;j<15;j++)
		{
			if(array[j]>twice)
				break;
			if(array[j]==twice)
				flag++;
		}
	}
	printf("%d\n\n",flag);
	}

	return 0;
}
int main()
{
	int a[16], len, count;                  //len???????count??????
	while(1)
	{
		cin >> a[0];
		if (a[0] == -1)                     //??????
		{
			break;
		}
		count = 0;
		len = 0;
		do
		{
			len++;
			cin >> a[len];
		}while (a[len] != 0);
		for (int i = 0; i < len; i++)       //a[len]=0???"<"
			for (int j = 0; j < len; j++)
			{
				if (j == i)
					continue;               //???????
				else
				{
					if (a[j] == (2 * a[i]))   
					{	
						count++;            //????????????????
                        break;              //????????
					}
				}
			}
		cout << count << endl;
	}
	return 0;
}
int main(int argc, char* argv[])
{
    
	int p;
	for(p=1;p<=100;p++){
		int a[17];
    	int u,i=0;
        for (u=1;u<=16;u++){
			scanf("%d",&a[u]);
		    i++;
		    if (a[u]==0){
			     break;
			}
		}
		if (a[1]==-1){
			break;
		}
    	int j,k,t;
    	for(j=1;j<i-1;j++){
	    	for(k=j+1;k<i;k++){
		    	if(a[j]>a[k]){
				    t=a[k];
			    	a[k]=a[j];
			    	a[j]=t;
				}
			}
		}
	    int r,s,w=0;
    	for(r=1;r<i-1;r++){
	    	for(s=r+1;s<=i-1;s++){
	   	    	if(a[r]*2==a[s]){
			    	w=w+1;
			    	break;
				}
			}
		}
	    printf("%d\n",w);
	}
	return 0;
}
void main()
{
	int c[16];
	int i,j,k,num;
	for(;c[0]!=(-1);)
	{   num=0;
	    scanf("%d",&c[0]);
		if(c[0]==(-1)) break;
	    for(i=1;i<16;i++)
		{
		    scanf("%d",&c[i]);
		    if(c[i]==0) break;
		}
	    for(j=0;j<i;j++)
		{
			for(k=0;k<i;k++)
			{
				if(2*c[k]==c[j])  {num+=1;}
			}
		}
		printf("%d\n",num);
	}
}
int main()
{
	int a[16], i, j, k, sum;
	do
	{
		sum = 0;
		i = 0;
		cin >> a[0];
		if (a[0] != -1)
		{
			do
			{
				i++;
				cin >> a[i];
			} while (a[i] != 0);
			for (j = 0; j < i; j++)
			{
				for (k = 0; k < i; k++)
				{
					if (a[k] == 2 * a[j])
						sum += 1;
				}
			}
			cout << sum << endl;
		}
		else 
			break;
	} while (1);
	return 0;
}
int main()
{
	int i,j,k,n=0,m,a[100][100],b[100]={0};
	for(i=0;;i++)
	{
		scanf("%d",&a[n][0]);
		if(a[n][0]==-1)
			break;
		for(j=1;;j++)
		{
		    scanf("%d",&a[n][j]);
		    if(a[n][j]==0)
			{
	            m=j;
				break;
			}
		}
		for(j=0;j<m;j++)
		{
			for(k=0;k<m;k++)
			{
				if(a[n][j]==2*a[n][k])
					b[n]++;
			}
		}
		printf("%d\n",b[n]);
		n++;
	}
	return 0;
}
int main()
{
	int i,j,x,y,count=0;
	int a[16];
	for(i=1;;i++)
	{
		count=0;
		for(j=0;;j++)
		{
			cin>>a[j];
			if((a[j]==0)||(a[j]==-1))
			break;
		}

		for(x=0;x<=j-1;x++)
		{
			for(y=0;y<=j-1;y++)
			{
				if(a[y]==a[x]*2)
				count=count+1;
			}
		}if(a[j]!=-1)
		cout<<count<<endl;
		}
	return 0;
}
int main(int argc, char *argv[])
{
  int a[16],i,j,k,m;
  for(;;)
  { 
    m=0;
    scanf("%d",&a[0]);
    if(a[0]==-1)
    break;
    for(i=1;i<16;i++)
    {
    scanf("%d",&a[i]);
    if(a[i]==0)
    break;
    }
    for(j=0;j<i;j++)
    {
         if(a[j]%2==0)
          {for(k=0;k<i;k++)
           {if((a[j]/2)==a[k])
            m++;}
           }
    }
    printf("%d\n",m);
  }                      	
  return 0;
}
int main()
{
	int a[16] = {0}, i, j, count;
	cin >> a[0];
	while (a[0] != -1)
	{
		count = 0;
		for (i = 1; ; i++ )
		{
			cin >> a[i];
			if (a[i] == 0)
			{
				break ;
			}
		}
		for (i = 0; a[i] != 0; i++ )
		{
			for (j = 0; a[j] != 0; j++ )
			{
				if (a[i] == 2 * a[j])
				{
					count ++ ;
				}
			}
		}
		cout << count << endl;
		cin >> a[0];
	}

	return 0;
}
int main()
{
    int data[16];
    int i, j;
    int len;
    int count;
    
    while(1)
    {
                  count = 0;
                  scanf("%d", &data[0]);
                  if(data[0] == -1)
                             break;
                  
                  for(i = 1; i <= 15; i++)
                  {
                        scanf("%d", &data[i]);
                        if(data[i] == 0)
                        {
                                   len = i;
                                   break;
                        }
                  }
                  
                  for(i = 0; i <= len - 1; i++)
                        for(j = 0 ; j <= len - 1; j++)
                              count = count + (data[i] == 2 * data[j]);
                              
                  printf("%d\n", count);
    }             
                  
    
 
    return 0;
}
//********************************
//*????? **
//*?????? **
//*???2012.10.29**
//********************************

int main() 
{  
    int a[16], whether, number = 0, numofpairs = 0; 
    //????a[16]?????NumOfPairs
    //whether?????????number?????????
    do
    {
        for ( int i = 0; i < 16; i++)
        {
            cin >> a[i]; //????
            if (a[i] == -1)
            {
                whether = 0; break;
            } //???-1?????????????
            else if (a[i] == 0)
            {
                whether = 1; break;
            } //???0???????????
            number++; //??????
        } //end??
        if (whether) //????-1???????
        {
            for (int j = 0; j < number; j++)
            {
                for (int k = 0; k < number; k++) 
                {
                    if (a[k] ==  2 * a[j]) numofpairs++;
                } //??????????
            }
            cout << numofpairs << endl; //??????
        }
        numofpairs = 0; number = 0; //????????? 
    } while (whether == 1); //???-1????? 
     
    return 0;                     
}
int main()
{	
	int t,sz[15],i=0,j,k,result=0;
	
	scanf("%d",&t);
	while(t!=-1)
	{
		if(t!=0){
			sz[i]=t;
			i++;
		}else{
			for(j=0;j<i;j++)
			{
				for(k=0;k<i;k++)
				{
					if(sz[k]==sz[j]*2){
						result++;
					}
				}
			}
			printf("%d\n",result);
			i=0;
			result=0;
		}
		scanf("%d",&t);
	}
	return 0;

}
void main()
{
	int s[16],i,n,a=0,j;
    scanf("%d",&s[0]);
	loop:
	a=0;
	i=1;
	do
	{
		scanf(" %d",&s[i]);
		i++;
	}
	while(s[i-1]!=0);
	n=i-1;
	for(i=0;i<n;i++)
	{
		for(j=1;j<n-i;j++)
		if(s[i]==2*s[i+j]||s[i+j]==s[i]*2) a=a+1;
	}
	printf("%d\n",a);
	scanf("%d",&s[0]);
	if(s[0]!=-1) goto loop;
}
int main()
{
	int a[101][16],b[100]={0},c[101],k,i,j,l,m;
	for (i=1;1;i++)
	{
		scanf("%d",&a[i][1]);
	    if (a[i][1]==(-1))
		{
			i--;
			break;
		}
		else
			for (j=2;1;j++)
		{
			scanf("%d",&a[i][j]);
			if (a[i][j]==0)
			{
				j=j-1;
				break;
			}
		}
		c[i]=j;
	}
	
	for (k=1;k<=i;k++)
	{
		for (l=1;l<=c[k];l++)
		{
			
			for (m=1;m<=c[k];m++)
			{
				if (a[k][m]/a[k][l]==2&&a[k][m]%a[k][l]==0)
					b[k]=b[k]+1;
				else
					b[k]=b[k];
			}
		}
		
	
		printf("%d\n",b[k]);
	}
	return 0;

}
int main()
{
	int a[16] = {0},n = 0,i,m,j;
	while(cin >> a[0])  
	{
		if(a[0] != (-1))
		{
        	for(i = 1;i <= 15;i++)
			{
	         	cin >> a[i];
				if(a[i] == 0)
					break;
			}
	        for(j = i-1;j >= 0;j--)
			{
				for(m = i-1;m >= 0;m--)
				{
					if(a[j] == 2 * a[m])
						n++;
				}
			}
			cout << n << endl;
			n = 0;
		}
		else
			break;
	}
	return 0;
}
int a[16];
int main()
{
	int n;
	while(1)
	{
		int i=0,s=0,j;
		while(1)
		{
			scanf("%d",&a[i]);
			if(a[i]==0||a[i]==-1)
			{
				
				n=i;
				break;
			}
			i++;
		}
		if(a[i]==-1)break;
		for(i=0;i<n-1;i++)
			for(j=i+1;j<n;j++)
			{
				if((a[i]==2*a[j])||(a[j]==2*a[i]))
				{
					s++;
			
				}
			}
		printf("%d\n",s);
			s=0;
	}
	return 0;
}
int main()
{
	int a[15],i,j,m,k,b,n;
	for(n=0;;n++){
	for(i=0;i<17;i++){
		scanf("%d",&m);
		if(m==0)break;
		if(m<0)goto er;
		a[i]=m;
	}
	k=i;
	b=0;
	for(i=0;i<k;i++){
		for(j=i+1;j<k;j++){
			if((a[i]==2*a[j])||(a[j]==2*a[i]))
				b=b+1;
		}
	}
	printf("%d\n",b);
	}
er:return 0;
}
main()
{
	int c[100][100],i=0,j=0,m,n,k,s=0;
	while(scanf("%d",&c[i][j]))
	{
		if(c[i][j]!=0&&c[i][j]!=-1)
			j++;
		else if(c[i][j]==0)
		{
			i++;
			j=0;
		}
		else break;
	}
	for(m=0;m<=i-1;m++)
	{
		for(n=0;c[m][n]!=0;n++)
		{
			for(k=0;c[m][k]!=0;k++)
			{
				if(c[m][n]==2*c[m][k])
					s++;
			}
		}
		printf("%d\n",s);
		s=0;
	}
}
main()
{
int a[16][16],i,j,k,m[16]={0},n,len,sum;
i=0;
	do{
	i=i+1;
j=0;
do{
j=j+1;
scanf("%d",&a[i][j]);
m[i]=m[i]+1;}while((a[i][j]!=0) && (a[i][j]!=-1));

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