semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int output = 0, i, j, length;
    float data[16];
    
    data[0] = -2;
    
    while(data[0] != -1)
    {
                  for(i = 0; i <= 15; i++)
                  {
                        scanf("%f", &data[i]);
                        if(data[i] == 0)
                        {
                                   length = i;
                                   break;
                        }
                        if(data[i] == -1)
                                   break;
                  }
                  
                  if(data[i] == -1)
                             break;
                  
                  for(i = 0; i <= length - 1; i++)
                        for(j = 0; j <= length - 1; j++)
                        {
                              if((data[j] / data[i]) == 2)
                                      output = output + 1;
                        }
                        
                  printf("%d\n", output);
                  output = 0;
    
    }
    
    
    return 0;
}
main()
{
  int i,j,n,num,a[17];
  do
   { i=0;
     do
      { i++;
        scanf("%d",&a[i]);
      }while(a[i]>0);
     n=i-1;
     if(a[n+1]!=-1)
      { num=0;
        for(i=1;i<=n-1;i++)
        for(j=i+1;j<=n;j++)
          if(a[i]==2*a[j]||a[j]==2*a[i])
            num++;
        printf("%d\n",num);
      }
   }while(a[n+1]==0);
  return 0;
}
void main()
{
	int a[16],i,sum=0,b,j,k,m;
	scanf("%d ",&b);
	while(b!=-1)
	{
	    a[0]=b;i=0;
            while(a[i]!=0)
	    {
		i++;
		scanf("%d ",&a[i]);
	    }
          
            for(j=1;j<i;j++)
            {    
               for(k=0;k<i-j;k++)
               {
                  if(a[k]>a[k+1])
                  {
                     m=a[k];
                     a[k]=a[k+1];
                     a[k+1]=m;
                  }
               }
            }
            for(j=0;j<i-1;j++)
            {
               for(k=j+1;k<i;k++)
               {
                  if(2*a[j]==a[k])
                  sum++;
               }
            }
            printf("%d\n",sum);sum=0;
            scanf("%d",&b);
	}
}
main()
{
	int c[100];
	int m,z;
	for(m=0;;m++){
		int i,j,k,n;
		int a[17],b[17];
		n=0;
		scanf("%d",&a[0]);
		b[0]=2*a[0];
		if(a[0]==-1){
			goto end;
		}
		else{
			for(i=1;a[i-1]!=0;i++){
				scanf("%d",&a[i]);
				if(a[i]==-1){
					goto end;
				}
				b[i]=2*a[i];
			}
			for(j=0;j<i-1;j++){
				for(k=0;k<i-1;k++){
					if(b[k]==a[j])
						n++;
				}
				c[m]=n;
			}
		}
	}
	end: for(z=0;z<m;z++)
			 printf("%d\n",c[z]);
}
int array[16]={0},n=0,sum=0;
int main()
{
    int i,j;
    while(1)
    {
            n=0;
            sum=0;            
            while(1)
            {
                    cin>>array[n];
                    if(array[n]==0 || array[n]==-1)
                    {
                      n--;
                      break;
                    }
                    n++;
            }
            if(array[0]==-1) 
             break;
            for(i=0;i<=n;++i)
            {
             for(j=i;j<=n;++j)
              {
                      if((array[i]==array[j]*2) || (array[j]==array[i]*2))
                            {
                             sum++;
                            }
                    }
            }
            cout<<sum<<endl;
    }
 
    return 0;
}
int main()
{
	int s[100][15],i,j,n,m,a[100],p,b[100]={0};
	for (i=0;;){
		for (j=0;;){
			scanf("%d",&s[i][j]);
			if (s[i][j]==0) {a[i]=j+1;i++;break;}
			else if (s[i][j]==-1) break;
            else j++;
		}
		if (s[i][j]==-1) break;
	}
	
	for (m=0;m<i;m++){
		for (n=0;n<a[m]-1;n++){
			for (p=0;p<a[m]-1;p++){
				if (s[m][p]==2*s[m][n])  b[m]++;	
			}
		}
	}
	
	for (m=0;m<i;m++){
		printf("%d\n",b[m]);
	}

	
}
int main()
{
	int a[15], count = 0;
	int i, j, k;
	for (i = 0; ; i++)
	{
		cin >> a[i];
		if (a[0] == -1) 
			break;
		else if (a[i] == 0)
		{
			for (j = 0; j < i; j++)
				for (k = 0; k < i; k++)
				{
					if (a[k] == a[j] * 2)
						count++;
				}
				cout << count << endl;
				count = 0;
				i = -1;
		}
	}
	
	return 0;
}
int main()
{
    int i,t,j,k,s=0;
    int a[17];
    for(scanf("%d",&a[1]);a[1]!=-1;scanf("%d",&a[1]))
    {
    for(i=2;;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]==0)
        {
            t=i-1;
            break;
        }        
    }
    for(j=1;j<=t;j++)
    {
        for(k=1;k<=t;k++)
        {
            if(a[j]==2*a[k])
            s=s+1;
        }
    }
    printf("%d\n",s);
    s=0;
    }
    return 0;
}
int main()
{   int a[500];
    int i,j,n,ans;
	for(;scanf("%d",&a[0]),a[0]!=-1;)
	{
		for(n=1;scanf("%d",&a[n]),a[n]!=0;n++);
		ans=0;
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++) if (a[i]==a[j]*2) ans++;
		printf("%d\n",ans);
	}
	return 0;
}
/*
?????2010?11?19
???????
??????????
????00948344 ??
*/
int main(){
	int k=1;
	while(k==1){
		int a[16];
		cin>>a[0];
		int l=0;
		if(a[0]==-1)         //??????-1???????????
		 k=0;
		else{
			while(a[l]!=0)   //???????0?????????
			{ 
				l++;
				cin>>a[l];
			}
			int i,j,num=0;   //num??????
			for(i=0;i<l-1;i++)
				for(j=i+1;j<l;j++)
					if(a[i]-2*a[j]==0||a[j]-2*a[i]==0)
						num++;
			cout<<num<<endl;
		}
	}
	return 0;
}
int main()
{
	int a[16],i,j,k,count,n;
	for(i=0;i<16;i++)
	{
		count=0;
		n=0;
		for(j=0;j<16;j++)
		{
			scanf("%d",&a[j]);
			if(a[0]==-1)
				break;
			if(a[j]==0)
				break;
			count++;
		}
		if(a[0]==-1)
			break;
		for(j=0;j<count;j++)
		{
			for(k=0;k<count;k++)
			{
				if(a[k]==2*a[j])
					n++;
			}
		}
		printf("%d\n",n);
	}
	return 0;
}
int main()
{
	int a[16];
	int i, j, count = 0;
	while(true)
	{
		cin >> a[0];
		if(a[0] == -1) 
			break;
		i = 1;
		while(true)
		{
			cin >> a[i];
			if (a[i] == 0)
				break;
			i ++;
		}

		count = 0;
		for(i = 0; a[i] != 0; i ++)
		{
			for(j = 0; a[j] != 0; j ++)
			{
				if (a[i] * 2 == a[j])
					count ++;
			}
		}

		cout << count << endl;
	}

	return 0;
}
int main()
{
    char exp;
    int i,c,t,w,n,s,t2,j,k,a[16];
    long m,e;
    float x,y;
    double r,d,b,h,g[100];



    for (; ;)
    {
        for (i=0;i<=15;i++) a[i]=0;
        for (i=0;i<=15;i++)
        {
            scanf("%d",&a[i]);
            if (a[i]==0) break;
            if(a[i]==-1) return 0;

        }
        n=i;
        s=0;
        for (i=0;i<n;i++)
        {
            for (j=0;j<n;j++)
                if (a[j]==2*a[i]) s=s+1;
        }
        printf("%d\n",s);
    }
    return 0;
}
/*
 * ??????.cpp
 *  ????: 2010-11-14
 *     ??????
 */


int main(){
	for(int i=0;;i++){//????
		int a[16];
		int temp;
		cin>>temp;
		if(temp==-1)
		break;//??-1???
		else a[0]=temp;
		int n=1;
		for(int j=1;;j++){
			int temp1;
			cin>>temp1;
			if(temp1==0)//??0???????
				break;
			else {a[j]=temp1;
			n++;
			}
		}
		int m=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){

				if((a[i]==(2*a[j])))
					m++;//??2????

			}
		}
		cout<<m<<endl;//????
	}
	return 0;
}
int main()
{
	int a[16],i,c=0,e=0,n,l;
	while(1)
	{
		for(i=0;i<16;i++)
		{
			scanf("%d",&a[i]);
			e=e+1;
			if(a[i]==0 || a[i]==-1) break;
		}
		if(a[i]==-1) break;
		for(l=0;l<e-1;l++)
			for(n=l+1;n<e-1;n++)
				{
					if((a[l]/a[n]==2 && a[l]%a[n]==0) || (a[n]/a[l]==2 && a[n]%a[l]==0))
						c=c+1;
				}
		printf("%d\n",c);
		int a[16]={0};
		e=c=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);
		printf("%d\n",b[j]);
		scanf("%d",&a[1]);
		j++;
	}
}
//******************************************
//*            ???????              *
//*            ??????                *
//*            ???1200012764            *
//*            ???2012/10/29            *
//******************************************
int main()
{
	int a, t, i;
	while (1)
	{
		a = 0;
		t = 0;
		cin >> a;
		if (a == -1)
		{
			break;
		}
		int num[17] = {0};
		num[1] = a;
		for (i = 2; i <= 16; i++)
		{
			cin >> num[i];
			if (num[i] == 0)
			{
				break;
			}
		}
		for (int r = 1; r <= (i - 1); r++)
		{
			for (int s = 1; s <= (i - 1); s++)
			{
				if (num[r] == 2 * num[s])
				{
					t = t + 1;
				}
			}
		}
			cout << t << endl;
	}
	return 0;
}
//???1134 ??
//??????
//???2010.11.7

int a[100][20] = {0};         //????????a[100][20]???????
int i = 1;                    //??????i???????????
int b[100] = {0};             //????????b[100]???????????

void sort();                  //????sort()?????
void compare();               //????compare()???????????
int main()
{
	int p = 0;
	int j = 0;

	do
	{
		j = 1;
		do
		{
			cin >> a[i][j];
			j ++;
		}while ((a[i][j-1] != 0) && (a[i][j-1] != -1));
		i ++;
	}while (a[i-1][j-1] != -1);           //??i???????a[i]?

	sort();                               //????
	compare();
	
	for (p = 1; p <= i - 2; p ++)
	{
		cout << b[p] << endl;             //????
	}

	return 0;
}

void sort()
{
	int x = 0;
	int y = 0;
	int p = 0;
	int t = 0;
	for (p = 1; p <= i - 2; p ++)          //???????a[i]??
		for (x = 1; x <= 14; x ++)
			for (y = 1; y <= 15 - x; y ++)
			{
				if (a[p][y] > a[p][y + 1])
				{
					t = a[p][y];
					a[p][y] = a[p][y + 1];
					a[p][y + 1] = t;
				}
			}
}

void compare()
{
	int x = 0;
	int y = 0;
	int p = 0;
	for (p = 1; p <= i - 2; p ++)            //??????????????
		for (x = 1; x <= 15; x ++)
			for (y = x; y <= 15; y ++)
			{
				if ((a[p][y] == 2 * a[p][x]) && (a[p][x] != 0))
					b[p] ++;
			}
}
//????1.cpp
//??????
//???1200062704
//???????????
int main()
{
	int a[16] = {0};                                    
	int i, j, num = 0;                             
	while(1)                           
	{
		for(i = 0; i < 16; i++)
		{
			cin >> a[i];                   
			if(a[i] == 0 || a[i] == -1)
			{
				break;
			}                                     
			if(i > 0)                         
			{
				for(j = 0; j < i; j++)
				{
					if(a[i] * 2 == a[j] || a[j] * 2 == a[i])
					{
						num++;
					}
				}
			}                
		}
		if(a[0] == -1)
		{
			break;
		}                                         
		cout << num << endl;
		num = 0;                                     
	}
	return 0;
}
void main()
{
 int a[20][16],s[20]={0},i,j,k,p=0,n[20]={0};
 for(i=0;i<20;i++)
 {
     scanf("%d",&a[i][0]);
     if(a[i][0]==-1) break;
     p=p+1;
     for(j=1;j<16;j++)
     {
       scanf("%d",&a[i][j]);
       if(a[i][j]==0) break;
       s[i]=s[i]+1;
     }
 }
 for(i=0;i<p;i++)
 for(j=0;j<=s[i];j++)
 for(k=0;k<=s[i];k++)
 if(a[i][j]==2*a[i][k]) n[i]=n[i]+1;
 for(i=0;i<p;i++)
 printf("%d\n",n[i]);
}
int main()
{
	int num[17], n, count = 1, result = 0;
	while ((cin >> n) && (n != -1))
	{
		if (n)
		{
			num[count] = n;
			count++;
		}
		else
		{
			for (int i = 1; i < count; i++)
			{
				for (int j = 1; j < count; j++)
				{
					if (num[i] == 2 * num[j])
						result++;
				}
			}
			cout << result << endl;
			result = 0;
			count = 1;
		}
	}

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

		for (i=1;i<16;i++)
		{
			cin>>a[i];
			if(a[i]==0)
				break;
		}	
	
		n=0;
		for(k=0;k<i;k++)
			for(j=0;j<i;j++)
			{
				if(a[k]==2*a[j])
					n++;
			}
			cout<<n<<endl;
	}
	while(1);
return 0;
}
int main(int argc, char *argv[])
{
   int a[1000],n,b[15],m,i,j,z,num=0;
   memset(a,0,1000*sizeof(int));
   memset(b,0,15*sizeof(int));
 while(1){
             i=0;
 do{

 scanf("%d",&m);
 if(m==0)
  break;
  if(m==-1)
  break;
 b[i]=m;
 i++;

 }while(1);
 if(m==-1)
 break;

 for(j=0;j<i;j++){
  for(z=0;z<i;z++){
   if(b[j]*2==b[z])
    a[num]++;
  }
 }
 num++;


 }
 for(j=0;j<num;j++)
  printf("%d\n",a[j]);

  return 0;
}
int main()
{
	int i,j,k,p,s[15];
	for(i=0;;i++)
	{
		k=0;
		scanf("%d",&s[0]);
		if(s[0]==-1)
			break;
		for(j=1;;j++)
		{
			scanf("%d",&s[j]);
			if(s[j]==0)
				break;
			for(p=0;p<j;p++)
				if(s[j]==2*s[p]||s[p]==2*s[j])
					k++;
		}			
		printf("%d\n",k);
	}
	return 0;
}
int main()
{
	int i, j, n, count;
	float a[20];
	while(1)
	{
		scanf("%f", &a[0]);
		if (a[0] == -1)
			break;
		n=1;
		while(1)
		{
			scanf("%f", &a[n]);
			if (a[n] == 0)
				break;
			n++;
		}
		count=0;
		for (i=0; i<n; i++)
		{
			for (j=i+1; j<n; j++)
			{
				if ((a[i]/a[j]==2.0) || (a[j]/a[i]==2.0))
					count++;
			}
		}
		printf("%d\n", count);
	}

	return 0;
}
int mat[300];

int main()
{
	int n,sum=0;
	while(scanf("%d",&n),n!=-1)
	{
		if(n)
		{
			mat[n]=1;
			if(mat[n<<1])
				sum++;
			if(!(n&1)&&mat[n>>1])
				sum++;
		}
		else
		{
			printf("%d\n",sum);
			sum=0;
			memset(mat,0,sizeof(mat));
		}
	}
}
int main()
{
  int a[20],i,j,k,m;
  while(1)
{   m=0;
    scanf("%d",&a[0]);
    if(a[0]==-1) break;
    else
    {for(i=1;;i++)
     {scanf("%d",&a[i]);
     if(a[i]==0) break;}
    }
    for(k=0;k<i;k++)
    {for(j=0;j<i;j++)
     { if((a[k]==2*a[j])&&(a[k]))
       m++;
     }
    }
    printf("%d\n",m);
}
}
int main(int argc, char* argv[])
{
	int x[16],a,b,i,k;
    
	while (1) 
	{


    for (i=0;i<16;i++) 
	{
	 scanf ("%d",&x[i]);
	  if (x[i]==0) 
	  {
	   a=i;
	   break;
	 
	  }
	 
	}
    if (x[0]==-1)
	 {
	 
	 break;
	 
	 }
    int s=0;
    for (k=0;k<a;k++) 
	{
	  for (i=0;i<a;i++) 
	  {
	  if (x[k]==2*x[i]) 
	  {
	  s++;
	  }
	  
	  }
	
	} 
    printf ("%d\n",s);
    }

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

}
//*********************************
//* ?????? **
//* ???1.cpp **
//* ????????? **
//* ???2012.10.31 **
//*********************************
int main()
{
	int i = 0, j, k, n, t = 0;                            
	int a[16];                                     //??????
	   while (cin >> n)                            //???n?????????
	   {
		 if (n != 0)                                 //???????0?????????????
		 {
		   a[i] = n;
	   	   i++;
		 }
		 else                                        //??????0????????
		 {
		   for (j = 0; j < i - 1; j++)                 //??????????????????
		   {
		      for (k = j + 1; k <= i - 1; k++)          //??????????????????
			  {
		         if (a[k] == 2 * a[j] || a[j] == 2 * a[k]) //????2?????t?1
			      t ++;                               
			  }
		   }
		   cout << t << endl;                          //??t???
		   t = 0;                                     //???????????t???0
		   i = 0;                                        //i???0
		 }	 
	   }
	return 0;
}
int main(int argc, char* argv[])
{
	int i,j,t=-1,s=0;
	int a[10000];
	for(i=0;i<=10000;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==-1)
			break;
		else if(a[i]==0)
		{
			t=i;
			printf("%d\n",s);
		    s=0;
		}
		else
		{
			for(j=t+1;j<i;j++)
			{
				if(a[i]==2*a[j]||a[j]==2*a[i])
					s=s+1;
			}

		}
	}




	return 0;
}
int main()
{
	int a,i,j,k,n;
	double f[15];
	cin >> a;
	while (a != -1)
	{
		i = 0;
	    while (a != 0)
		{
			f[i] = a;
     	    i++;
			cin >> a;
		}
		j = i;
		n = 0;
		for (i = 0 ; i < j ; i++)
		{
			for (k = i + 1 ; k < j ; k++)
			{
				f[k] = f[k]*1.0;
				if ((f[k] / f [i]) == 2.0 || (f[i] / f [k]) == 2.0)
					n = n + 1;
			}
		}
		cout << n << endl;
		cin >> a;
	}
	cin.get();
    cin.get(); //????
	return 0;
}
int main(int argc, char* argv[])
{
	int sz[15];
	int a,i,k,count=0;
	for(i=0;i<15;i++)
	{
		scanf("%d",&a);
		if(a==-1)break;
		else if(a==0)
		{   i=-1;
			printf("%d\n",count);
			count=0;
			continue;
		}
		else sz[i]=a;
	    for(k=0;k<=i;k++)
		{
			if(sz[i]==sz[k]*2||sz[k]==sz[i]*2)count++;
		}
	}
	return 0;
}
int main()
{
int i , j , n , t , m , x , l;
int a[15];
for ( m =1 ; ;m++)
{
  for ( x=1 ; x<=16 ; x++)
  {
    cin>>l;
    if (l!=0)
    {
      a[x-1]=l;
    }
    else
    {
      n = x - 1;
      t = 0 ;
      for ( i=0 ; i<=n-2 ; i++)
       {
         for ( j=i+1 ; j<=n-1 ; j++)
          {
           if ((a[i]==2*a[j])||(a[j]==2*a[i]))
           t++;
          }
        }
      cout<<t<<endl;
      break;
     }
   }
 }
return 0;
}
int main()
{
  int a[16],i,j,r,k;
  while(1)
  {
      scanf("%d",&a[0]);
      if(a[0]==-1)
      {
          break;
      }
      r=0;i=0;
      while(a[i]!=0)
      {
          i++;
          scanf("%d",&a[i]);
      }
      for(k=0;k<i;k++)
      {
          for(j=0;j<i;j++)
          {
              if(a[j]==2*a[k])
              {
                  r++;
              }
          }
      }
      printf("%d\n",r);
  }


    return 0;
}
//***********************************************************
//* ? ??1.cpp                                            *
//* ? ??? ? 1200012916                                 * 
//* ? ??2012?10?31?                                   *
//* ? ????                                             *
//***********************************************************

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

	return 0;
}
int main()
{
	static int a[16],b[16];
	int n,i,j,s=0;
	while(scanf("%d",&a[0]),a[0]!=-1)
	{
		for(i=1;a[i-1]!=0;i++)
		{b[i-1]=2*a[i-1];
		scanf("%d",&a[i]);}
		n=i-2;
		s=0;
		for(i=0;i<=n;i++)
		for(j=0;j<=n;j++)
		if(a[i]==b[j])
		{
			s++;break;
			}
		printf("%d\n",s);
		}	
}
//??.c 

int main(){
    int data;
    int a[15];
    int i=0;
    int j,k;
    while(scanf("%d",&data)!=EOF){
        if(data==-1) break;
        else{
            if(data!=0){
                a[i] = data;
                i++;
            }
            else{
                int tmp;
                for(j=0;j<i;j++){
                    for(k=j+1;k<i;k++){
                        if(a[j]>a[k]){
                            tmp=a[k];
                            a[k]=a[j];
                            a[j]=tmp;
                        };
                    }
                }//??
                int cnt=0;
                for(j=0;j<i;j++){
                    for(k=j+1;k<i;k++){
                        if(a[j]*2==a[k]){
                            cnt++;
                            break;
                        }
                        if(a[j]*2<a[k]) break;
                    }
                }
                printf("%d\n",cnt);
                cnt=0;
                i=0;
            }
        }
    }
    return 0;
}
int find(int *x,int y,int z)
{
 int count=0;
 for(int i=0;i<y;i++)
 {if(x[i]==z) count++;}
 return count;
}

int count(int *x,int y)
{
  int count1=0;
  for(int i=0;i<y;i++)
  {count1+=find(x,y,2*x[i]);} 
  return count1;
}

int main()
{
 int temp[16];
 int len=0;
 scanf("%d",&temp[len]);
 while(temp[len]!=-1)
 {
  while(temp[len]!=0)
  {len++;
  scanf("%d",&temp[len]);
    }
  printf("%d\n",count(temp,len));
  scanf("%d",&temp[0]);
  len=0;
 }
 return 0;
}
int main()
{
	int n,i,j,num,count=0,array[15];
	while(cin>>n&&n!=-1)
	{
		memset(array,0,sizeof(array));
		array[0]=n;
		i=1;num=1;
		while(cin>>n&&n!=0)
		{
			array[i++]=n;
			num++;
		}
		sort(array,array+num);
		for(i=num-1;i>0;i--)
			for(j=i-1;j>=0;j--)
			{
				if(array[i]==2*array[j])
					count++;
			}
		cout<<count<<endl;
		count=0;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int i, num;
	int sz[100] = {0};
	int j,k;
	int geshu=-1;
	while(1)
	{
		i = 0;
		scanf("%d",&num);
		if ( num == -1 )
			break;
		sz[0] = num;
		while(1)
		{
			if ( sz[i] == 0 )
				break;
			i++;
			scanf("%d",&sz[i]);
		}
		for(k=0;k<=i;k++){
			for(j=0;j<=i;j++){
				if(sz[j]==2*sz[k]){
					geshu=geshu+1;
				}
			}
		}
		printf("%d\n",geshu);
		geshu=-1;
	}
	return 0;
}
int main()
{
    int a[16],i,j,k;
while(1)
    { 
   int s=0;
   for(i=0;;i++)
   { 
    cin>>a[i];
    if(a[i]==0)break;
    if(a[i]==-1)goto end;
   }
   for(j=0;j<=i-1;j++)
    for(k=0;k<=i-1;k++)
     if(a[j]%a[k]==0&&a[j]/a[k]==2) s++;
     cout<<s<<endl;
}
end:
return 0;
}
//??  ???  1100012858

int main()
{
	int num [16];   //??????
    int i = 1;  //????i?????????+1
	int n;
	int j,k,ans;   //ans?????
	i = 1;         //???????
	do 
	{
		cin >> n;    //n????????
		if (n != -1)
		{
			if (n == 0)
			{
			   ans = 0;
	           for (j = 1;j <= i-1;j++)
		           for (k = 1;k <= i-1;k++)
			           if (num[j] == 2*num[k])
				          ans += 1;
	           cout << ans << endl;
	           i = 1;              //???????
			}                                 //?????????????
			else
			{
				num[i] = n;                  //??????????
				i += 1;
			}
		}
	}while (n != -1);
	return 0;
}
int main()
{int a[100][15],i,j,k,l;
for(i=0; ;i++)
 {cin>>a[i][0];
   if(a[i][0]==-1) break;
  else
     {int n=0;
      for(j=1; ;j++)
       {cin>>a[i][j];
         if(a[i][j]==0) break;}
         for(k=0;k<=j-1;k++)
          for(l=0;l<=j-1;l++)
            if(a[i][k]==2*a[i][l]) n=n+1;
        
       
     cout<<n<<endl;}
   }
return 0;

}
int main()
{
	int i,n,a[100]={0},p;
	scanf("%d",&p);
	while (p>0)
	{
		for(i=0;i<100;i=i+1)
			a[i]=0;
		for(;p>0;)
		{ 
			a[p]=1;
			scanf("%d",&p);
		}
		n=0;
	for(i=1;i<50;i=i+1)
		if (a[i]&&a[2*i]) n=n+1;
		printf("%d\n",n);
		scanf("%d",&p);
	}
   
	return 0;
}
void main()
{
	int b;
	scanf("%d",&b);
	while(b!=-1)
	{
		int a[15]={0};
		int i=1;
		int k,j;
        int sum=0;
		a[0]=b;
		scanf("%d",&a[i]);
		while(a[i]!=0)
		{
			i++;
			scanf("%d",&a[i]);
		}
		for(k=0;k<i;k++)
		{
			for(j=k+1;j<i;j++)
			{
				if(a[j]==2*a[k]||a[k]==2*a[j])
					sum++;
			}
		}
        printf("%d\n",sum);
		scanf("%d",&b);
	}		
}
int main()
{
	int n;
	int num[100];
	int test,count=0;
	

	cin >> n;
	while(n != -1)
	{
		num[0] = n;
		for (int i = 1; n != 0; i++)
		{
			cin >> n;
			num[i] = n;
		}
		for (int j = 0; num[j] != 0; j++)
		{
			test = num[j];
			for (int k = 0; num[k] != 0; k++)
			{
				if (num[k] == 2 * test)
				{
					count++;
				}
			}//end for k
		}//end for j
		cout << count << endl;
		count=0;
		cin >> n;
	}

	return 0;
}
int main()
{
	int a[101][16],b[100]={0},c[101],k,i,j,l,m;
	for (i=1;i<=100;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 n=0,k=0,j,i,a[16],m=0;
	do
	{
		for(i=0;i<=15;i++)
		{
			cin>>a[i];
			n++;
		if(a[i]==0)break;
		if(a[i]==(-1))break;
		}
                  if(a[0] == -1)break;
		for(j=0;j<n;j++)
		{
			for(k=j+1;k<n;k++)
			{
				if(a[j]==a[k]*2||a[k]==a[j]*2)
					m++;
			}
		}
		cout<<m<<endl;
		m=0;
		n=0;
	}while(a[0]!=(-1));
	return 0;
}
int main()
{int a[17]={0};
int i=0,m=0,k=0,j=0;
do{
	scanf("%d",&a[0]);
	while(a[i]!=0&&a[0]!=-1)	
	{
		i=i+1;
		scanf("%d",&a[i]);
	}
	if(a[0]!=-1)
	{
		for(j=0;j<i;j++)
		{
			for(k=i-1;k>j;k--)
			{
				if(a[k]==2*a[j]||a[j]==2*a[k])
					m=m+1;
			}
		}
		printf("%d\n",m);
	}
	for(j=0;j<i;j++)
		a[j]=0;
	m=0;
	i=0;
  }
while(a[0]!=-1);
}