semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*
 * ????.cpp
 *
 *  Created on: 2010-11-17
 *      Author: IBM
 */


int main(){
	int n,k,i,j;                                             //n?2?????
	int a[16];
	while(cin>>a[0]&&a[0]!=-1){               //?????????-1
		k=1;                                            //????????
		n=0;
		while(cin>>a[k]&&a[k]!=0)         //???????0
			k++;                                   //??????1
		for(i=0;i<k-1;i++)
			for(j=i+1;j<k;j++)
				if((a[i]==a[j]*2)||(a[j]==a[i]*2))   //??????????2??1/2
					n++;                   //2?????1
		cout<<n<<endl;                         //????
	}
	return 0;
}
/**
 * @file        1.cpp
 * @author      ???
 * @date        2013-10-9
 * @description ?????????
 */
int main(void)
{
    int a[16], i, k = 0, j = 0, n = 0;
    for( i = 0 ; i < 16 ; i++ )
        a[i] = -1;
    cin >> k;
    while( k != -1 )
    {
        a[j] = k;
        j++;
        if( k == 0 )
        {
            for( i = 0 ; i < 15 ; i++ )
                for( j = i + 1 ; j < 15 ; j++ )
                    if( ( a[j]- 2 * a[i] == 0 ) || ( a[i] - 2 * a[j] == 0 ) )
                        n++;
            cout << n << endl;
            for( i = 0 ; i < 16 ; i++ )
                a[i] = -1;
            j = 0;
            n = 0;
        }
        cin >> k;
    }
    return 0;
}
/*
 * file : 1.cpp
 * author : ??? 1200012911
 * time ?2012.10.29
 * function : ????
 */



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

	i=0;
	j=0;
	while(1)
	{
		cin >> num[i];
		if(num[i] == -1)
		{
			break;
		}

		while(1)
		{
			if(num[i] == 0)
			{
				temp = 0;
				for(m=0; m<i; m++)
				{
					for(n=0; n<i; n++)
					{
						if(num[m] == 2*num[n])
						{
							temp++;
						}
					}
				}
				result[j] = temp;

				i=0;
				j++;
				break;
			}
			else
			{
				i++;
				cin >> num[i];
			}
		}
	}

	for(m=0; m<j; m++)
	{
		cout << result[m] << endl;
	}
	return 0;
}
//********************************
//*?????   **
//*?????? 1300012713 **
//*???2013.10.30  **
//********************************
int main() 
{ 
	int m, n, num, a[15]; //??????m????????n??????num???a[15]
	while (cin >> m) //???????
	{
		if (m == -1) return 0; //????-1??????
		else //???m????????
		{
		    int n = 1;
		    num = 0;
			a[0] = m;
			for(int i = 1; ; i++) //??????
			{
				cin >> a[i];
			    if(a[i] == 0) break; //????0?????????0
				if(a[i] != 0) n = n + 1;
			}
			for(int j = 0; j <= n; j++) //????????
			{
				for(int k = j+1; k <=n; k++)
				{
					if(a[j] == 2 * a[k] || a[k] == 2 * a[j])
						num = num + 1; //????
				}
			}
			cout << num << endl; //????
		}
	}
}
int main() {
	int a[20],s=0;
	while (scanf("%d",&a[++s])!=EOF) {
		if (a[1]==-1) break;
		do scanf("%d",&a[++s]); while (a[s]!=0);
		s--;
		int ans=0;
		for (int i=1;i<=s;i++)
			for (int j=1;j<=s;j++)
				if (a[i]*2==a[j])
					ans++;
		printf("%d\n",ans);
		s=0;
	
	}
    return 0;
}
int main()
{
int a[18],m,i=0,j=0,k=0,l=0,n=0;

for(n=0;;n++)
{
scanf("%d",&a[0]);
if(a[0]==-1)
break;
else
{
for(i=1;;i++)
{
scanf("%d",&a[i]);
if(a[i]==0)
{m=i-1;break;}
}//??a[i]
i=0;
 
 for(i=0;i<=m;i++)
 {
  for(j=0;j<=m;j++)
   {
     if(a[j]==(2*a[i]))
     k++;
    }
  l=l+k;k=0;//printf("%d\n",l);
 }//????a[i],???a[i]??

printf("%d\n",l);
l=0;
}

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

}
int main(){
	int a[20],i,j,k,s;//a?????? i?????????????  s???????
	for(s=0,cin>>a[1];a[1]!=-1;s=0,cin>>a[1]){//??????????
		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]==2*a[k])s++;
		cout<<s<<endl;
	}
	return 0;
}
/*
 * ??.cpp
 *
 *  Created on: 2011-11-2
 *      Author:Administrator
 */

int main(){
    int a[16],i,n,j,total;
    while(cin>>a[0]&&a[0]!=-1){
    	i=1;
    	while(cin>>a[i]&&a[i]!=0){
    		i++;
    	}
    	n=i;
    	total=0;
    	for(i=0;i<n;i++)
    		for(j=0;j<n;j++){
    			if(a[j]==2*a[i])total++;
    		}
    	cout<<total<<endl;
    	}
    return 0;
}
int main(int argc, char* argv[])
{
	int x1,x2,n[15],y;	
	int  i;
	int t;
	while(1){
         //?0?8?0?1?0?8?0?5?0?1?0?7?0?4?0?4?0?8?0?5?0?6?0?6 
         i=0;         
         while(1){
               scanf("%d",&t);
               if(t==-1){
          
                 return 0;
               }                        
               if(t==0)
                   break;
               else{
                   n[i]=t;
                   i++;
               }
         }         
         y=0;
         for(x1=i-1;x1>=0;x1--){
            for(x2=x1-1;x2>=0;x2--){
              if( n[x1]==n[x2]*2 || n[x2]==n[x1]*2 )
				y+=1;
            }			
		 }
		 printf("%d\n",y);
    }
 
	return 0;
}
int main()
{
	int a[16],k,m,n,j;
	do
	{   j=0;
		scanf("%d",&a[0]);
	    if(a[0]!=-1)
		{ 
			for(k=1;k<=15;k++)
			{
				scanf("%d",&a[k]);
                if(!a[k])break;
			}
            for(m=0;m<k-1;m++)
			{
				for(n=m+1;n<k;n++)
				{
					if((a[m]-2*a[n]==0)||(a[n]-2*a[m]==0))
					j++;
				}
			}
			printf("%d\n",j);
		}
	}
	while(a[0]!=-1);
	return 0;
}
int main()
{
	int a[16],i,j,k,s;
	for(;;)
	{	s=0;
		scanf("%d",&a[0]);
	    if(a[0]==-1) break; 
		for(i=1;i<=15;i++)
		{	scanf("%d",&a[i]);
		   if(a[i]==0)  break;
		}
		for(j=0;j<=i-1;j++)
		{   
			for(k=0;k<=i-1;k++)
			{	if(a[k]==2*a[j]) s=s+1; } 
		}
        printf("%d\n",s); 
	}
	return 0;
}
int main()
{
	int a[15],s,i,j,k,flag=1;
    while(flag)
	{
		s=0;
		for(i=0;i<16;i++)
		{                    /*????????????0*/
		scanf("%d",&a[i]);
	    k=i;  /*??k?????*/
		if(a[i]==-1)
		{
			flag=0;
			break;
		}
        if(a[i]==0)break;
		}
		if(flag)
		{
		for(i=0;i<k;i++)
			for(j=0;j<k;j++)
			{
				if(a[i]==2*a[j]) 
					s++;
			} /*?????????????*/
			printf("%d\n",s);
		}
	}
    return 0;
}
int main()
{
	int i,j,k=0;
	int sz[16],erbei[16],sum=0;
	for(i=0;;i++){
		scanf("%d",&sz[i]);
		if(0==sz[i]){
			for(j=0;j<i;j++){
				erbei[k]=2*sz[j];
				k++;
			}
			for(k=0;k<i;k++){
				for(j=0;j<i;j++){
					if(erbei[k]==sz[j]){
						sum++;
					}
				}
			}
			printf("%d\n",sum);
			sum=0;
			i=-1;
			k=0;
		}
		if(-1==sz[i]){
			break;
		}
	}
	return 0;
}
int main()
{
    int a[20],i,j,n,court;
    while (1)
    {
        for (i = 0; 1 ; i++)
        {
            cin >> a[i];
            if (a[i] == 0)
                break;
        }
        if ( a[0] == -1 )
            break;
        n = i;
        for (i = 0, court = 0 ; i <= n; i++)
        {
            for (j = i; j <= n - 1; j++)
            {
                if (a[j] == 2 * a[i] || a[i] == 2 * a[j])
                    court++;
            }
        }
        cout << court << endl;
    }
    return 0;
}
int main()
{
	int key;  // key?????????
	int number, total; // number???????total????
	while ((cin >> key) && (key != -1)) // ??????????-1??????
	{
		int num[15];  // num[15]??????
		num[0] = key; 
		int i = 1; // ?????????key,i????1
		int flag1 = 0, flag2 = 0; // flag1, flag2????????2???
		total = 0;  // ??????total????0
		while ((cin >> number) && (number != 0)) // ??????
		{
			num[i] = number;
			i++;
		}
		for (int k = 0; k <= i - 2; k++)
		{
			for (int r = k + 1; r <= i - 1 ; r++)
			{
				flag1 = (num[r] == 2 * num[k]);
				flag2 = (num[k] == 2 * num[r]);
				if ((flag1 == 1) || (flag2 == 1))
				{
					total = total + 1;
				} // end if
			} // end for
		} // end for
		cout << total << endl;
	}
	return 0;
}
int main()
{
	int a[17] , i , j , k;
	for (i = 1 ; i <= 16 ; i++)
	{
		a[i] = 1;
	}
	int count = 0;
	while (cin >> a[1])
	{
		if (a[1] == -1)
		{
			break;
		}
		else
		{
            for (i = 2 ; a[i - 1] != 0 ; i++)
			{
			   cin >> a[i];
			}
		}
		i = i - 2;
	    for (j =1 ; j <= i ; j++)
		{
			for (k=1 ; k <= i ; k++)
			{
				if (a[k] == 2 * a[j])
				{
					count++;
					break;
				}
			}
		}
		cout << count << endl;
		count = 0;
	}
	return 0;
}
//?????????
int main()
{
	int i,j,m=0,count=0;//????
	int num[100];
	for(;;)
	{
		m=0;
		for(i=0;;i++)
		{
			cin>>num[i];//????
			if(num[i]==0||num[i]==-1)//??????????
			{
				count=i;
				break;
			}
		}
		if(num[0]==-1)
			break;
		else
		{
			for(i=0;i<count;i++)//?????????
				for(j=i+1;j<count;j++)
				{
					if((num[i]==2*num[j])||(num[j]==2*num[i]))//?????????
						m++;
				}
				cout<<m<<endl;//????
		}
	}
	return 0;
}
//**************************
//*?????              **
//*?????? 1300012863 **
//*???2013.11.1        **
//**************************
int main()  
{ 
	int a[20];
	int n,i,j,k;
	for(k=1; ;k++)
	{
     memset(a,0,sizeof(a));
	n = 0;
	i = 1;
	cin>>a[1];
    if(a[1]!=(-1))
	{
		if(a[1]!=0)
		{
		for(i=1; ; )
		{
		    i++;
			cin>>a[i];
		    if(a[i]!=0)
		    {
			for(j=1;j<=(i-1);j++)
			{
				if((a[i]==2*a[j])||(a[j]==2*a[i]))
			    {
					n = n + 1;
				}
		    }
			}
			else
		    {
			cout<<n<<endl;
			break;
		    }
		}
		}
	}
	else
	{
		break;
	}
	}
return 0;
}
int main()
{
	int a[16];//???0????????????
	int num = 0;
	int s;//??2??????
	int i , j;//?????
	cin >> a[num];
	while (a[num] != -1)
	{
		while (a[num] != 0)
		{
			num++;
			cin >> a[num];
		}
		num--;//?????0????
		s = 0;
		for (i = 0; i <= num; i++)
			for (j = 0; j <= num; j++)
				if (a[i] == a[j] * 2)
					s++;
		cout << s << endl;
		num = 0;
		cin >> a[num];
	}

}
int main()
 {  
int s[20],i=1,j,k,d=0;
  char c;
  do{
while(scanf("%d",&s[i]))
{
c=getchar();
if(c=='\n')
break;
i++;
}
     for(k=1;k<i;k++)
 {
  for(j=k+1;j<i;j++)
  {
if((s[k]==2*s[j])||(2*s[k]==s[j]))
d++;
  }

 }
 if(s[i]>-1)
printf("%d\n",d);
i=1;
d=0;
  }while(s[i]>-1);
 return 0; 

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

    for(i=1;i<20;i++)
	{
      if(num[i-1][0]!=-1)
	  {
       	for(j=0;j<16;j++)
		{
			scanf("%d",&num[i][j]);
			if(num[i][j]==0 || num[i][j]==-1)
			break;
		}
	  }
	  else break;
	}

	for(i=0;i<20;i++)
	{
      if(num[i][0]==-1)
          break;
      else 
	  {
       	for(j=0;j<16;j++)
		{
		  if(num[i][j]==0)
			break;
		  else
		  {
			for(t=0;t<16;t++)
			{
		      if(num[i][t]==0)
		    	break;
			  else
			  {
				  if(num[i][t]==2*num[i][j])
			       count++;
			  }
			}
		  }
		}

        printf("%d\n",count);
		count=0;
	  }
	}	
}
int main()
{
	int i,j,m,n,x;
	int sz[16];
	while(1)
	{
		x=0;
		for(i=0;i<16;i++){
			scanf("%d",&sz[i]);
			if(sz[i]==0||sz[i]==-1){
				break;
			}
		}
		if(sz[i]==-1){
			break;
		}
		for(m=0;m<=i-2;m++){
			for(n=m+1;n<=i-1;n++){
				if(sz[m]==2*sz[n]||sz[n]==2*sz[m]){
					x++;
				}
			}
		}
		printf("%d\n",x);
	}
	return 0;
}
void main(){
int x[16], i, j, g, n, m;
for(j=0;;j++){
  for(i=0,n=0;i<16;i++){
	scanf("%d", &x[i]);
	if(x[i]==0)break;
  }
  if(x[0]==-1)break;
  g=i;
  for(i=0; i<g; i++){
	  for(m=0;m<g;m++){
      if((float)x[i]==x[m]*2)n++;
	  }
  }
  printf("%d\n", n);
}
}
void main(){
	int i,j,l,t,m,count[50],lie[20];
	char p;
	for(i=0;i<50;i++){
for(j=0;j<20;j++){
scanf("%d",&lie[j]);
if(lie[0]==-1) goto lalala;
scanf("%c",&p);
if (p=='\n') break;
}
count[i]=0;
for(l=0;l<j;l++)
for(t=0;t<j;t++)
if((lie[l]-2*lie[t])==0)
count[i]=count[i]+1;
}
lalala:for(m=0;m<i;m++){
printf("%d",count[m]);
if(m!=i-1)
printf("\n");
}
}
int main()
{
	float a[16];
    int j, num;
	while (1)
	{
          num = 0;
    for (int i = 0; i < 16; i++)
    {
        cin >> a[i];
        if (a[0] == -1)
            break;
        if (a[i] == 0)
        {
           j = i - 1;      
           break;
        }   
    }
    if (a[0] == -1)
       break;   
    for (int i = 0; i <= j; i++)
    {
        for (int k = 0; k <= j; k++)
        {
            if (a[i] / a[k] == 2 && i != k)
               num++;
        }
    }
    cout << num << endl;
    }
	return 0;
}
/**
 * @file   1.cpp
 * @author ???
 * @date   2013-10-30
 * @description
 *         ?????????
 */



int main()
{
	int a[16] = {0};                                // ??????????????0
	int sum = 0;                                    // ?????????????sum?????0

	do
	{
		sum = 0;

		cin >> a[0];

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

		for (int i = 1; i <= 15; ++i)               // ??????????????
		{
			cin >> a[i];
			if (a[i] == 0) break;                   // ???????0????????
		}

		for (int m = 0; m <= 13; ++m)               // ????????????
		{
			if (a[m + 1] == 0) break;
			for (int n = m + 1; n <= 14; ++n)
			{
				if (a[n] == 0) break;
				if (a[m] == 2 * a[n] || a[n] == 2 * a[m]) ++sum;
			}
		}

		cout << sum << endl;                         // ????

	} while (1);

	return 0;
}
int main(){
	int su[17]={1};
	int c[100];
	int i,a,b,d,e=0;
	for(i=0;i<100;i++){
		c[i]=0;}
	for(d=0;d<100;d++){
		a=0;
		for(i=1;su[i-1]!=0;i++){
			scanf("%d",&su[i]);
			if(su[i]==-1){
				e=1;
				break;
			}
			a=a+1;
		}
		if(e){break;}
		for(i=1;i<a;i++){
			for(b=1;b<a;b++){
				if(su[i]==2*su[b]){
					c[d]+=1;}
			}
		}
	}
	for(i=0;i<d;i++){
			printf("%d\n",c[i]);}


	return 0;

}
int main()
{
    int i=0,j=0,k=0;
    int a[16];
    for(;;i++)
    {
		scanf("%d",&a[i]);
		if(a[i]==0)
		{
			printf("%d\n",k);
			i=-1;
			k=0;
		}

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

		for(j=0;j<i;j++)
			if(a[i]==a[j]*2||a[j]==a[i]*2)
				k++;
	}
}
int main()
{
	int number[16]={0};
	int m,i=1;
	while(m!=-1)
	{
		do
		{
			cin>>m;
			number[i]=m;
			i++;
		}while(m!=0&&m!=-1);
		int k=1,t,j=0;
		for(k=1;k<=i-1;k++)
		{
			t=number[k];
			int p;
			for(p=1;p<=i-1;p++)
			{
				if(t==2*number[p])
				{
					j++;
				}
				else continue;
			}
		}
	if(m!=-1)
	{
		cout<<j-1<<endl;
	}
	else break;
	i=1;
	j=0;
	}
	return 0;
}
int main()
{
	int a[16];
	int i,j,k,l;
	while(scanf("%d",&a[0])&&a[0]!=-1)
	{	l=0;
		if(a[0]!=0)
		{
			for(i=1;a[i-1]!=0;i++)
			{
				scanf("%d",&a[i]);
			}
			for(j=0;j<=i-1;j++)
				for(k=0;k<j;k++)
					if(a[k]==2*a[j]||a[j]==2*a[k]) l++;
		printf("%d\n",l);
		}
		else printf("%d\n",l);
	}
	return 0;

}
main()
{
    int a[15][15],i=0,j=0,s=0,m=0,h=0,g[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},b[15];
    while(1)
    {
        scanf("%d",&a[i][j]);
        if(a[i][j]==0)
        {
            b[i]=j;
            i=i+1;
            j=0;

        }
        else if(a[i][j]==-1)
        {
            break;
        }
        else j=j+1;
    }
    for(s=0;s<i;s++)
    {
        for(m=0;m<b[s];m++)
        {
            for(h=0;h<b[s];h++)
            {
                if(a[s][m]==2*a[s][h])
                {
                    g[s]=g[s]+1;
                }
            }
        }
    }
    for(s=0;s<i;s++)
    {
        printf("%d\n",g[s]);
    }
    return 0;
}
void main()
{
	int a[15]={1},n,m,i,j,t;
	scanf("%d",&a[0]);
	while(a[0]!=-1)
	{
		i=1;n=1;
		scanf("%d",&a[1]);
		while(a[i]!=0)
		{
			n++;
			i++;
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
			for(j=i+1;j<n;j++)
				if(a[i]>a[j])
				{
					t=a[i];
					a[i]=a[j];
					a[j]=t;
				}

/*for(i=0;i<n;i++)printf("%d ",a[i]);
printf("\n");*/
				 m=0;
				for(i=0;i<n;i++)
					for(j=i+1;j<n;j++)
					if(a[j]==2*a[i])
					{
						m++;
						break;
					}
					printf("%d\n",m);
scanf("%d",&a[0]);
	}
}
int main()
{
    float s[16],t[16];
	int u=0,g=0;
	for(int k=1;k<100;k++)
	{
		int a=0;
		for(int i=0;i<16;i++)
		{
			scanf("%f",&s[i]);
			if(s[0]==-1||scanf(""))
				printf("");
			else
			{
				u+=1;
				if(s[i]==0)break;
				else
				{
					t[i]=s[i];
					a++;
				}
			}
		}
			int b=0;
			for(int h=0;h<a;h++)
			{
				for(int k=0;k<a;k++)
				{
					if(t[h]/t[k]==2)
						b++;
				}
			}
			printf("%d\n",b);
			g++;
			if(g==u)
			printf("");
		}
	  
	return 0;
}
int main(){
    int i,j,m,a[16];

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

    	while (1){
			scanf("%d",&a[0]);
			if(a[0]==-1)
				break;
			for(i=1;;i++){
				scanf("%d",&a[i]);
				if(a[i]==0)
					break;
			}
			n=i;
			for(i=n-1;i>0;i--){
				for(j=0;j<i;j++){
					if(a[j]>a[j+1]){
						k=a[j];
						a[j]=a[j+1];
						a[j+1]=k;
					}
				}
			}
			m=0;
			for(i=0;i<n-1;i++){
				for(j=i+1;j<n;j++){
					if(a[j]==2*a[i]){
						m=m+1;
						break;
					}
					if(a[j]>2*a[i]){
						break;
					}
				}
			}
			printf("%d\n",m);
		}
	return 0;
}
int main(int argc, char* argv[])
{
	float p[100][999];
	int i,m;
	for(m=0;;m++){
	for(i=0;;i++){
		scanf("%f",&p[m][i]);
		if(p[m][i]==0) break;
	}
	if(p[m][0]==-1) break;
	else{
          int a=0;
		  for(int j=0;j<i;j++){
			  for(int k=0;k<i;k++){
				  if(p[m][j]/p[m][k]==2) a++;
				  else a=a;
			  }
		  }
		  printf("%d\n",a);
		  }
	}
	return 0;
}
int main()
{
    int i,k,j;
    int count=0;
    int sz[16]={0};
    for(i=0;i<16;i++){
	scanf("%d",&sz[i]);
	if(sz[i]==0){
	    for(k=0;k<i-1;k++){
		for(j=k+1;j<i;j++){
                      if(sz[k]==2*sz[j]||sz[k]*2==sz[j]){
			count++;
		    }
		}
	    }
	    printf("%d\n",count);
	    count=0;
	    i=-1;
	}
	
	if(sz[i]==-1){
	    break;
	}
    }
    return 0;
}
//************************************************************************************
//*    name: 1.cpp                                                                   *
//*    author:??                                                                   *
//*    date: 2013-10-30                                                              *
//*    description???????????????????????????????     *
//************************************************************************************
int main ()
{
	int t ;//???????????????
	int a[16] , i ,j,k,count;
	while(cin>>t)
	{
		count = 0;
		if(t<0) return 0 ;//??-1?????
		a[0]=t ;//????????????????
		for(i=1;i<16;i++)
		{
			cin >> a[i] ;
			if(a[i]==0) break ;//???????0????
		}
		for (j=0 ;j<i;j++)//???i???????
		{
			for(k=0;k<i;k++)
			{
				if(a[k]==2*a[j]) count++ ;//????????????????????1
			}
		}
		cout << count <<endl ;
	}
}
int main()
{
	for(;;)
{
	int a[16];
	int i,j,k,m,n=0;
	for(i=0;i<16;i++)
	
	{   
		scanf("%d",&a[i]);

		if(a[i]==0)
		{for(m=i+1;m<16;m++)
		a[m]=101;
		break;
		}
	}     
	if(a[0]==-1)
			break;
	for(j=0;j<i;j++)
		for(k=0;k<i;k++)
		{if(a[k]*2-a[j]==0)
		n++;
		}
	printf("%d\n",n);
}
	return 0;
}
/**?????
  *???2010/11/5
  *??????
  *???1000010449
*/
int main()
{
	int a[16], len, count, i, j;
	while (1)
	{
		cin >> a[0];
		if (a[0] == -1)
		{
			break;
		}
		len = 0;
		do
		{
			len++;
			cin >> a[len];
		}while (a[len] != 0);
        count = 0;
		for (i = 0; i < len; i++)
		{
			for (j = 0; j < len; j++)
			{
				if (j == i)
				{
					continue;
				}
				else
				{
					if (a[j] == (2 * a[i]))
						count++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}
int main()
{
	int i,j,k,a[16],num;
	while(scanf("%d",&a[0]),a[0]+1)
	{
		i=1;
		num=0;
		while(scanf("%d",&a[i]),a[i])
		{
			i++;
		}
		for(j=0;j<i;j++)
		{
			for(k=j+1;k<i;k++)
			{
				if(a[j]==2*a[k]||a[k]==2*a[j])
				{
					num++;
				}
			}			
		}
		printf("%d\n",num);
	}
	return 0;
}
int main ()
{
	int i,j,k;
	while(1)
	{
		int a[20]={0},sum=0;
		for(i=0;;i++)
		{
			scanf("%d",&a[i]);
			if(a[i]==0) {k=i;break;}
		}
		if(a[0]==-1) break;
		for(i=0;i<k;i++)
			for(j=i;j<k;j++)
			{
				if(a[j]==2*a[i]||2*a[j]==a[i]) sum++;
			}
		printf("%d\n",sum);
	}
}
int main()
{
    int a[100000];
    int i,j,k;
    int m;
    int n;
    for(i=0;i<100000;i++)
    {
        cin>>a[i];
        if(a[i]==-1)
        break;
        if(a[i]==0)
        {
            n=0;
            for(j=0;j<i;j++)
            {
                for(k=0;k<i;k++)
                {
                    if(a[k]==0)
                    continue;
                    if(a[j]==2*a[k])
                    n=n+1;
                }
            }
            cout<<n<<endl;
            a[0]=0;
            i=0;
        }
    }
    return 0;
}
int main()
{
	int n[100][15],i=0,j,k,count,t;
	for(i=0;;i++)
	{
		count=0;
		j=0;
		do
		{
			cin>>n[i][j];
			if(n[i][j]==-1)
				goto loop;
			j++;
		}
		while(n[i][j-1]!=0);
		for(k=0;k<j;k++)
		{
			for(t=j-1;t>k;t--)
			{
				if(n[i][t]==2*n[i][k] || 2*n[i][t]==n[i][k] )
					count++;
			}
		}
		cout<<count<<endl;
	}
loop:return 0;
}
/*
 * 9.cpp
 *
 *  Created on: 2010-11-19
 *      Author: ???
 *        ??? ??
 */



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

int find( int* s, int x, int l, int r )
{
    if ( l > r ) return 0;
    int mid = (l+r)/2;
    if ( s[mid] == x ) return 1;
    else
    {
        if ( s[mid] > x ) return find(s,x,l,mid-1);
        else return find(s,x,mid+1,r);
    }
}

int main()
{
    int n = 0, i = 0, j = 0;
    int x = 0;
    int s[1000] = {0};
    while ( (scanf("%d", &x), x) != -1 )
    {
        if ( x != 0 )
        {
            s[n++] = x;
            for ( i = n-1; (i>0) && (s[i] < s[i-1]); i-- )
                swap(&s[i],&s[i-1]);
        }
        else
        {
            int count = 0;
            for ( i = 0; i < n; i++ )
            {
                if ( find(s,2*s[i], i+1, n) )
                    count++;
            }
            printf("%d\n",count);
            for ( i = 0; i < n; i++ )
                s[i] = 0;
            n = 0;
        }
    }
    return 0;
}
int main()
{
	int a[100],m,n,i,j,k,p;
	i=0;
	while(scanf("%d",&m)!=EOF)
	{	
		if(m==-1)
			break;
		else
			if(m==0)
			{
				for(j=0,n=0;j<=i-2;j++)
					for(p=j;p<=i-1;p++)
						if(a[j]==a[p]*2||a[p]==a[j]*2)
							n++;
				printf("%d\n",n);
						i=0;
			}
			else
			{
				a[i]=m;
				i++;
			}
	}
}
int main()
{
	int i,j,k=1,flag=1;
	int a[16]={0};
	int c[100]={0};
	while(flag)
	{
		for(i=1;i<16;i++)
		{
		scanf("%d",&a[i]);
		if(a[i]==-1){flag=0;break;}
		if(a[i]==0){k++;break;}
		for(j=i-1;j>0;j--)
			{
				if(a[i]==2*a[j]||2*a[i]==a[j])c[k]++;
			}
		}
	}
	for(i=1;k>0&&i<k;i++)printf("%d\n",c[i]);
	return 0;
}
int main()
{
	int n[25], i, j, count;
	while (cin >> n[1], n[1] != -1)
	{
		count = 0;
		for (i = 2; cin >> n[i], n[i] != 0; i++)
		{
			for (j = 1; j < i; j++)
			{
				if (n[i] == 2 * n[j] || n[i] * 2 == n[j])
				{
					count++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}