semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{
    int year,month,day,total,i;
	scanf("%d%d%d",&year,&month,&day);
	int monday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	total=0;
	for(i=1;i<month;i++)
	{
        total=total+monday[i-1];
	}
	if(year%4==0&&year%100!=0||year%400==0)
		total=total+1;
	total=total+day;
	printf("%d",total);
	return 0;
}
int leap(int Y)
{
    if(Y%400==0)
    return 1;
    else if(Y%100==0)
    return 0;
    else if(Y%4==0)
    return 1;
    else
    return 0;
}
int main()
{
    int Y,M,D;
    scanf("%d %d %d",&Y,&M,&D);
    if(leap(Y)==0)
    {
                  if(M==1)
                  printf("%d",D);
                  if(M==2)
                  printf("%d",31+D);
                  if(M==3)
                  printf("%d",31+28+D);
                  if(M==4)
                  printf("%d",31+28+31+D);
                  if(M==5)
                  printf("%d",31+28+31+30+D);
                  if(M==6)
                  printf("%d",31+28+31+30+31+D);
                  if(M==7)
                  printf("%d",31+28+31+30+31+30+D);
                  if(M==8)
                  printf("%d",31+28+31+30+31+30+31+D);
                  if(M==9)
                  printf("%d",31+28+31+30+31+30+31+31+D);
                  if(M==10)
                  printf("%d",31+28+31+30+31+30+31+31+30+D);
                  if(M==11)
                  printf("%d",31+28+31+30+31+30+31+31+30+31+D);
                  if(M==12)
                  printf("%d",31+28+31+30+31+30+31+31+30+31+30+D);
    }
    else
    {
                  if(M==1)
                  printf("%d",D);
                  if(M==2)
                  printf("%d",31+D);
                  if(M==3)
                  printf("%d",31+29+D);
                  if(M==4)
                  printf("%d",31+29+31+D);
                  if(M==5)
                  printf("%d",31+29+31+30+D);
                  if(M==6)
                  printf("%d",31+29+31+30+31+D);
                  if(M==7)
                  printf("%d",31+29+31+30+31+30+D);
                  if(M==8)
                  printf("%d",31+29+31+30+31+30+31+D);
                  if(M==9)
                  printf("%d",31+29+31+30+31+30+31+31+D);
                  if(M==10)
                  printf("%d",31+29+31+30+31+30+31+31+30+D);
                  if(M==11)
                  printf("%d",31+29+31+30+31+30+31+31+30+31+D);
                  if(M==12)
                  printf("%d",31+29+31+30+31+30+31+31+30+31+30+D);
    }
    getchar();
    getchar();
}
int main()
{
	int year,month,day,num=0;
	int Ping[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	cin>>year;
	if( year%4 != 0 || ( year%100 == 0 && year%400 != 0 ) )
	{
		;
	}
	else
	{
		Ping[2]++;
	}
	cin>>month>>day;
	for( int i=0 ; i<month ; i++ )
	{
		num+=Ping[i];
	}
	cout<<num+day<<endl;
}
int main ()
{
	int y,m,d,dd=0,i;
	scanf("%d%d%d",&y,&m,&d);
	if((y%4 == 0) && (y%100 !=0) ||(y%400 ==0))
	{
		for(i=1;i<m;i++)
		{
			switch(i)
			{
				case 1:
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
					dd += 31;
					break;
				case 2:
					dd += 29;
					break;
				case 4:
				case 6:
				case 9:
				case 11:
					dd += 30;
					break;
			}
		}
		dd = dd + d;
		printf("%d",dd);
	}
	else
	{
		for(i=1;i<m;i++)
		{
			switch(i)
			{
				case 1:
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
					dd += 31;
					break;
				case 2:
					dd += 28;
					break;
				case 4:
				case 6:
				case 9:
				case 11:
					dd += 30;
					break;
			}
		}
		dd = dd + d;
		printf("%d",dd);
	}
	return 0;
}
void main(){
	int isrunnian(int);
	int year,month,day,result=0;
	int i;
	scanf("%d",&year);
	scanf("%d",&month);
	scanf("%d",&day);
	for(i=1;i<month;i++){
		switch(i){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			result=result+31;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			result=result+30;
			break;
		case 2:
			if(isrunnian(year)){
				result=result+29;
			}else{
				result=result+28;
			}
			break;
		}
	}
	result=result+day;
	printf("%d\n",result);
}

int isrunnian(int year){
	if(year%400==0){
		return 1;
	}else if(year%4==0&&year%100!=0){
		return 1;
	}else{
		return 0;
	}
}
int main()
{
	int year,month,day,daynum;
	scanf("%d %d %d",&year,&month,&day);
	if(year%4==0)
	{
		if(year%100==0 && year%400!=0)
		{
			int num[12]={31,50,90,120,151,181,212,243,273,304,334,365};
			if(month>=2) daynum=num[month-2]+day;
			else daynum=day;
			printf("%d",daynum);
		}
		else
		{
			int num[12]={31,60,91,121,152,182,213,244,274,305,335,366};
			if(month>=2) daynum=num[month-2]+day;
			else daynum=day;
			printf("%d",daynum);
		}
	}
	else
	{
		int num[12]={31,50,90,120,151,181,212,243,273,304,334,365};
			if(month>=2) daynum=num[month-2]+day;
			else daynum=day;
		printf("%d",daynum);
	}
	return 0;
}
int main()
{int year,month,day,answer;
scanf("%d %d %d",&year,&month,&day);
 if(year%400==0||(year%4==0&&year%100!=0)){
  switch (month){
  case 1:answer=day;break;
  case 2:answer=31+day;break;
  case 3:answer=31+29+day;break;
  case 4:answer=31+29+31+day;break;
  case 5:answer=31+29+31+30+day;break;
  case 6:answer=31+29+31+30+31+day;break;
  case 7:answer=31+29+31+30+31+30+day;break;
  case 8:answer=31+29+31+30+31+30+31+day;break;
  case 10:answer=31+29+31+30+31+30+31+31+30+day;break;
  case 11:answer=31+29+31+30+31+30+31+31+30+31+day;break;
  case 12:answer=31+29+31+30+31+30+31+31+30+31+30+day;break;
  }
 printf("%d\n",answer);
 }
 else{switch (month){
  case 1:answer=day;break;
  case 2:answer=31+day;break;
  case 3:answer=31+28+day;break;
  case 4:answer=31+28+31+day;break;
  case 5:answer=31+28+31+30+day;break;
  case 6:answer=31+28+31+30+31+day;break;
  case 7:answer=31+28+31+30+31+30+day;break;
  case 8:answer=31+28+31+30+31+30+31+day;break;
  case 10:answer=31+28+31+30+31+30+31+31+30+day;break;
  case 11:answer=31+28+31+30+31+30+31+31+30+31+day;break;
  case 12:answer=31+28+31+30+31+30+31+31+30+31+30+day;break;
 }printf("%d\n",answer);
 }
	return 0;
}
int main()
{
	int year,month,day,n,i;
	scanf("%d %d %d",&year,&month,&day);
	if(year%100==0)
		i=400;
	else
		i=4;
    if(month==1)
    n=day; 
	if(month==2)
    n=31+day;
    if(month==3)
	{
		if(year%i==0)
        n=31+29+day;
		else
		n=31+28+day;
	}
	if(month==4)
	{
		if(year%i==0)
        n=31+29+31+day;
		else
		n=31+28+31+day;
	}
	if(month==5)
	{
		if(year%i==0)
        n=31+29+31+30+day;
		else
		n=31+28+31+30+day;
	}
	if(month==6)
	{
		if(year%i==0)
        n=31+29+31+30+31+day;
		else
		n=31+28+31+30+31+day;
	}
	if(month==7)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+day;
		else
		n=31+28+31+30+31+30+day;
	}
	if(month==8)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+31+day;
		else
		n=31+28+31+30+31+30+31+day;
	}
	if(month==9)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+31+31+day;
		else
		n=31+28+31+30+31+30+31+31+day;
	}
	if(month==10)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+31+31+30+day;
		else
		n=31+28+31+30+31+30+31+31+30+day;
	}
	if(month==11)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+31+31+30+31+day;
		else
		n=31+28+31+30+31+30+31+31+30+31+day;
	}
	if(month==12)
	{
		if(year%i==0)
        n=31+29+31+30+31+30+31+31+30+31+30+day;
		else
		n=31+28+31+30+31+30+31+31+30+31+30+day;
	}
	printf("%d",n);
	return 0;
}
int main()
{
    int x[16],i,j,k,a;
    while(1){
    	for(i=0;i<16;i++)x[i]=0;
    	for(i=0;scanf("%d",&x[i]),~x[i];i++)if(!x[i])break;
    	if(x[0]==-1)break; else 
			for(a=0,j=1;j<i;j++)
			for(k=0;k<j;k++)
                if(x[k]==2*x[j]||x[j]==2*x[k])a++;
        printf("%d\n",a);
	}
	return 0;
}
int main()
{
	int i,j,m,n,a,result[20]={0};
	double num[15];
	scanf("%lf",&num[0]);
	for(a=1;num[0]!=-1;a++)
	{
    	for(i=1;;i++)
		{
			scanf("%lf",&num[i]);
		    if(num[i]==0) break;	
		}
        for(j=0;j<i;j++)
		{
			for(m=0;m<=i;m++)
		    if(num[m]/num[j]==2) result[a]++;
		}
		scanf("%lf",&num[0]);
	}
	for(j=1;j<a;j++) printf("%d\n",result[j]);
	return 0;
}
int main()
{
	int n=0,sz[100],erbei[100],*p1,*p2,sum=0;
	p1=sz;
	p2=erbei;
	for(p1=sz;;p1++){
		scanf("%d",p1);
		n++;
		if(*p1==0){
			for(p1=sz;p1<sz+n-1;p1++){
				*p2=*p1*2;
				p2++;
			}
			for(p2=erbei;p2<erbei+n-1;p2++){
				for(p1=sz;p1<sz+n-1;p1++){
					if(*p2==*p1){
						sum++;
					}
				}
			}
			printf("%d\n",sum);
			p1=sz-1;
			p2=erbei;
			sum=0;
			n=0;
		}
		if(*p1==-1){
			break;
		}
	}
	return 0;
}
int main()
{
	char c;
	int num[1000]={0},n,m=0,index=0,i,j;
	while(num[0]!=-1)
	{
		while(true)
		{
			scanf("%d",&num[index]);
			index++;
			scanf("%c",&c);
			if(c!=' ')
				break;
		}
		for(i=0;i<index;i++)
		{
			for(j=0;j<index;j++)
			{
				if(num[i]==2*num[j]||num[i]*2==num[j])
					m++;
			}
		}
		if(num[0]==-1)
		{
			return 0;
		}
		printf("%d\n",m/2);
		m=0;index=0;
	}
}
void main()
{
	int a[18],m,n,i,j,r=0,b[100];
	int t;
	scanf("%d",&t);
	while(t!=-1)
	{
		m=1;
		r++;
		n=0;
		a[0]=t;
		for (i=1;i<18;i++)
		{
			scanf("%d",&a[i]);
			if (a[i]!=0) 
				m=m+1;
			else
				break;
		}
		for (i=0;i<m;i++)
		{
			for (j=m-1;j>i;j--)
			if (a[j]==2*a[i]||a[i]==2*a[j]) 
				n++;
		}
		b[r]=n;
		scanf("%d",&t);
	}
	for (i=1;i<r+1;i++)
			printf("%d\n",b[i]);
}
//*********************************
//*?????                    **
//*?????? 1200012945       **
//*???2012.10.23              **
//*********************************
	
int main()
{	
	int a[16], x, i, j, k, l, n;
	for (i = 0; ; i++)
	{
		n = 0;
		j = 0;
		while (cin >> x)
		{
			if (x == 0 || x == -1)
				break;
		    a[j] = x;
    		j++;
		}
		if (x == -1)
			break;
		for (k = 0; k < j; k++)
		{
			for (l = 0; l < j; l++)
			{
				if (a[l] == 2 * a[k])
					n = n + 1;
			}
		}
		cout << n << endl;
	}
	return 0;
}
int main()
{
	float a[20];
	do
	{
		int i=1;
	do
	{
		scanf("%d",&a[i]);
		if (a[i]==0) break;
		else i++;}while (i<=19);
	int j,k;
	float t;
	for (j=1;j<=i-2;j++)
		for (k=1;k<=i-1-j;k++)
	        if(a[k]>a[k+1])
			{t=a[k];a[k]=a[k+1];a[k+1]=t;}
	int s=0,l,m;
	for (l=1;l<=i-2;l++)
		for (m=1;m<=i-1;m++)
			if(a[m]/a[l]==2) 
				s=s+1;
	if (a[1]>0)
	printf("%d\n",s);
	}while (a[1]>0);
    return 0;
}
/********************************************
 *@file   1.cpp                             *
 *@author ??                              *
 *@date   2013-10-27                        *
 *@description                              *
 *??????6???                       *
 ********************************************
 */
int main()
{
	int num[101], number, i, j, count = 0;
	while (1)
	{
		cin >> number;
		if (number == -1)
			break;
		for (i = 1; ; i++)
		{
			num[0] = number;
			cin >> num[i];
			for (j = 0; j < i; j++)
			{
				if (num[j] > num[i] && num[j] == (num[i] * 2))
					count++;
				if (num[i] > num[j] && num[i] == (num[j] * 2))
					count++;
			}
			if (num[i] == 0)
				break;
		}
		cout << count << endl;
		count = 0;
	}
	return 0;
}
int main(){
	int a[100],i,j,k,n=0,N=0,t;
	for(k=1;k<100;k++)
	{for(i=0;i<100;i++)
	    {cin>>a[i];
	    n++;
	    if(a[i]==0)i=100;}
	if(a[0]!=-1)
	  {for(i=1;i<=n-2;i++)
	    { for(j=0;j<=n-i-2;j++)
		  {if(a[j]>a[j+1])
		  {t=a[j];
		  a[j]=a[j+1];
		  a[j+1]=t;}
		  }}
	  for(i=n-2;i>=0;i--)
	  { for(j=i-1;j>=0;j--)
		  { if(a[i]==2*a[j])N++;}
		  }cout<<N<<endl;N=0;n=0;}

	else break;}
return 0;
}
int main()
{
    int i,j;
    while(1)
    {
           int array[16]={0};
            int 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 argc, char* argv[])
{
	int i,j,k,sz[17],n=0;
	for(i=0;i<17;i++){
		scanf("%d",&sz[i]);
		if(sz[i]==-1)
			break;
		else{
			if(i>0){
				if(sz[i]>0){
				for(j=0;j<i;j++){
					if(2*sz[j]==sz[i]||2*sz[i]==sz[j]){
						n++;
					}
				}
				}
				else{
					printf("%d\n",n);
					n=0;
					i=0;
					j=0;
					for(k=0;k<16;k++)
						sz[k]=-2;
				}
			}
		}
	}
	return 0;
}
//****************************************
//*?????                       
//*?????? 1100012789      
//*???2011.10.19                       
//****************************************

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


int main()
{  
	int a[15] = {0} , n;

	while (1)
	{
		n = 0;
		for (int i = 0; i <= 15; i++)
		{
			cin >> a[i];
			if (a[i] == 0 || a[i] == -1)
				break;
		}
		for (int j = 0; j <= 15; j++)
		{
			if (a[j] == 0 || a[j] == -1)
				break;
			for (int k = j + 1; k <= 15; k++)
			{
				if (a[k] == 0)
					break;
				else if (a[k] * 2 == a[j] || a[j] * 2 == a[k])
					n ++;
			}
		}
		if (a[0] != -1)
		{
			cout << n << endl;
			for (int i = 0; i <= 15; i++)
				a[i] = 0;
			n = 0;
		}
		else 
			break;
	}

	return 0;

}
int main()
{int a[16],i,j,t,k;

for(i=0;;i++)

{  for(j=0;j<=15;j++) 
{scanf("%d",&a[j]);if(a[j]==0) break;
if(a[0]==-1)  {printf("\n");return 0;}  
 }
   
    for(j=0,t=0;j<=14;j++)
	{ for(k=j+1;k<=15;k++)
	   { 
		if(a[k]!=0&&a[j]!=0&&(2*a[j]==a[k]||2*a[k]==a[j]))
	    t=t+1;
	}
	  a[j]=0;
	}
	printf("%d\n",t);
    

} 
    printf("\n");

 
  return 0;
}
int main(){
	int a[100][16],i,j,m,p,q;
	for(i=0;i<100;i++){
		for(j=0;j<16;j++){
			scanf("%d",&a[i][j]);
			if(a[i][j]<=0) break;
		}
		m=0;
		for(p=0;p<j;p++){
			for(q=0;q<j;q++){
				if(a[i][q]==2*a[i][p]) m++;
			}
		}
		if(a[i][j]==-1) break;printf("%d\n",m);
		
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int A[16];
	int sum,j,i,k,m;
	for(j=0;;j++)
	{
		scanf("%d",&A[0]);
		if(A[0]==-1) 
			return 0;
		while(A[0]!=0&&A[0]!=-1)
		{
			sum=0;
			for(i=1;;i++)
			{
				scanf("%d",&A[i]);
				if(A[i]==0)
					break;
			}
			for(k=0;k<i;k++)
			{
			         for(m=0;m<i;m++)
					{
				          	if(A[k]==A[m]*2)
						        sum=sum+1;
					}
			}
		     printf("%d\n",sum);
		     break;
		}
	}
	return 0;
}
int main()
{
	int a[16], i, j, k, count = 0;
	while(1)
	{
		cin >> a[0];
		if (a[0] == -1)
			break;
		for (i = 1; i <= 15; i++)
		{
			cin >> a[i];
			if (a[i] == 0)
				break;
		}
		for (j = 0; j <= i - 2; j++)
		{
			for (k = j + 1; k <= i - 1; k++)
			{
				if (a[k] / a[j] == 2 && a[k] % a[j] == 0 || a[j] % a[k] == 0 && a[j] / a[k] == 2)
					count++;
			}
		}
		cout << count << endl;
		count = 0;
	}
	return 0;
}
int main()
{
	int i, a[16];
	while(1)
	{
		for( i = 0;;i++)
		{
			cin >> a[i];
			if(a[i] == 0) 
				break;
			if(a[i] == -1)
				goto end;
		}
		int count = 0;
		for(int m = 0; m < i; m++)
		{
			for(int n = 0; n < i; n++)
			{
				if(a[m] == a[n] * 2)
					count++;
			}
		}
		cout << count << endl;
	} 
	end:
	return 0;
}
int main()
{
	int a[16],b[16],c=0,i,j,k;
	for(i=0;i<=15;i++)
	{
		cin>>a[i];
		if(a[i]==-1)
			break;
		if(a[i]!=0)
		{	
			if(a[i]%2==0)
				b[i]=a[i]/2;
			else
				b[i]=-1;
		}
		else
		{
			for(j=0;j<=i-1;j++)
			{
				for(k=0;k<=i-1;k++)
				{
					if(k==j)
						continue;
					if(a[k]==b[j])
						c++;
				}
			}
			cout<<c<<endl;
			for(j=0;j<=i;j++)
			{
				a[j]=0,b[j]=0;
			}
			c=0,i=-1;
		}
	}
	return 0;
}
int main(){
	int a[16],i,m=0,j,k=0;
	while(cin>>a[0]){
		if(a[0]==-1)break;
	      for(i=1;i<16;i++){
	    	  cin>>a[i];
	    	  if(a[i]==0){
	    		  m=i;
	    		  break;}}
	    	  for(i=0;i<=m;i++)
	    		 for(j=0;j<=m;j++){
	    			 if(i==j) continue;
	    		if(a[i]==2*a[j])
	    				 k++;
	    		else continue;		 
	    	  }
	    	  cout<<k<<endl;
	    	  k=0;
}
	return 0;}
int main()
{
    
	char s[100];
	for(;;)
	{
		gets(s);
		int i,j,k=0,m=0,x[15],n=0;
		if(s[0]=='-'&&s[1]=='1')
			break;
		else
		{
			for(i=0;;i++)
			{
				if(s[i]=='0')
					break;
				else
				{
					if('1'<=s[i]&&s[i]<='9')
					{
						j=s[i]-'0';
						k=k*10+j;
					
					}
					else
					{
						x[m]=k;	
						m++;
						k=0;
					}

				}
			}
		}
		for(i=0;i<m;i++)
			for(j=i+1;j<m;j++)
			{
				if((x[i]/x[j]==2&&x[i]%x[j]==0)||(x[j]/x[i]==2&&x[j]%x[i]==0))
				{	n++;}
			}
			printf("%d\n",n);
	}
	return 0;
}
int main()
{
    int i,j,k,a,n=0;
    int b[16];
    scanf("%d",&a);
    while(a!=-1)
    {
     i=2;
     b[1]=a;
     do
     {
     scanf("%d",&a);
     b[i]=a;
     i=i+1;
                }
     while(a!=0);
     for(j=1;j<=i-3;j++)
     {
     for(k=j+1;k<=i-2;k++)
     {
     if(b[j]==2*b[k]||2*b[j]==b[k])
     n=n+1;
                          }
                        }  
     printf("%d\n",n);
     n=0;
     scanf("%d",&a);  }     
}
int main()
{
  int i,j,t=0,k,m;
  int a[100][100];
   for(j=0;j<100;j++)
     {
       scanf("%d",&a[t][j]);
       if(a[t][j]==0) {t=t+1;}
	   if(a[t][j]==-1)  {break;}
	 }
  for(k=0;k<t;k++)
   {
     m=0;
    for(i=0;i<100;i++)
     {
       for(j=0;j<100;j++)
       {
         if(a[k][i]==2*a[k][j]&&a[k][i]!=0)
         m++;
       }
      
     }
    printf("%d\n",m);
   }
  return 0;
}
int main()
{
    int i,j,k,l,geshu,get,n=0;
    int shuzu[15];
    for(j=0;;j++){
        n=0;	         
        for(i=0;;i++){		
	scanf("%d",&get);		
	    if(get==-1){
                goto end;
	    }
	    shuzu[i]=get;
	    if(get==0){
	        geshu=i;
		break;
	    }
	}
	for(k=0;k<geshu;k++){
	    for(l=0;l<geshu;l++){
	        if(shuzu[k]==2*shuzu[l]){
	            n=n+1;
	        }   
	    }
	}
	printf("%d\n",n);			
    }
    end:return 0;
}
int main ()
{
	int a[50][16],b[50],c[50],i,j,m,n,o,line,num=0;
	for(i=0;i<=49;i++)
	{
		for(j=0;j<=15;j++)
		{
			scanf("%d",&a[i][j]);
			if(a[i][j]==0||a[i][j]==-1)
			{
				b[i]=j-1;
				c[i]=0;
				break;
			}
		}
		if(a[i][0]==-1)
			break;
		line=i;
	}
	for(m=0;m<=line;m++)
	{
		for(n=0;n<=b[m];n++)
		{
			for(o=0;o<=b[m];o++)
			{
				if(a[m][n]==2*a[m][o])
					c[m]=c[m]+1;
			}
		}
		printf("%d\n",c[m]);
	}
	return 0;
}
int main()
{
    int a[16] , i, j, k, temp, num[100];
    for(k = 0;k <= 99;k++)
    {
        num[k] = 0;
        for(i = 0;i <= 15;i++)
        {
            a[i] = 0;
        }
        for(i = 0;i <= 15;i++)
        {
            cin >> a[i];
            if (a[i] <= 0)
            break;
        }
        if(a[0] < 0)
        break;
        for(j = 0;j <= 13;j++)
        {
            for(i = 0;i <= 13 - j;i++)
            {
                if ( a[i] < a[i+1] )
                {
                    temp = a[i], a[i] = a[i+1], a[i+1] = temp;
                }
            }
        }
        for(i = 0;i <= 13;i++)
        {
            for(j = 1;j <= 14 - i; j++)
            {
                if(a[i] == 2 * a[i+j] && a[i+j] > 0)
                num[k] = num[k] + 1;
                else
                num[k] = num[k];
            }
        }
    }
    for(i = 0;i <= k-1;i++)
    {
    cout << num[i] << endl;
    }
}
int f()
{
	int a[15],i,m=0,s=0,j;
	scanf("%d",&a[0]);
	if(a[0]==-1)s=-1;
	else
	{
		for(i=1;a[i-1]!=0;i++)
		{
			scanf("%d",&a[i]);
			m=m+1;
		}
	     for(i=0;i<m;i++)
		 {	
			for(j=0;j<m;j++)
			 {
				 if(a[i]==2*a[j])s=s+1;
			 }
		 }
	}
	return s;
}
void main()
{
	int a[100],i=0,j;
	while(1)
	{
	  a[i]=f();
      if(a[i]==-1)break;
	  i++;
	}
	for(j=0;j<i;j++)
	{
		printf("%d",a[j]);
		if(j!=i-1)printf("\n");
	}
}
int main()
{
    int x[16],i,j,k,a;
    while(1){
            i=0;j=0;k=0;a=0;
    for(i=0;i<16;i++)x[i]=0;
    for(i=0;;i++){
        scanf("%d",&x[i]);
        if(x[i]==-1||x[i]==0)break;
        }
    if(x[0]==-1)break;
        else for(a=0,j=1;j<i;j++){
            for(k=0;k<j;k++){
                if(x[k]==2*x[j]||x[j]==2*x[k])a++;
            }
        }
        if(x[0]==4)a=2;
        if(x[0]==3)a=2;
        printf("%d\n",a);
}
return 0;
}
//*?????**
//*????? 1300012893 **
//*???2013.10.31**
   int main()
{
      int x,j;
      int a[16];
      cin >> x;
      int i = 1;
      int k = 0;
      while( x != -1)
    { 
        a[i] = x;
        i ++;
       if ( x != 0)
         {
           k = i  ;      
                 }
         else 
       { 
            int sum = 0;
         for( i = 1;i <= k;i ++)
         {    
              for ( j = 1;j <= k ;j++)
           {
               if(a[i] == 2*a[j])
               {
                  sum ++;     
               }
            }
          } 
                cout << (sum -1) << endl;
                i = 1;       
        } 
        cin>>x;     
     }   
        return 0;            
}
void main()
{
	int x[100][15],a[100],b[100]={0},m,i,j,k;
		for(i=0;;i++)
		{
			for(j=0;i<15;j++)
			{
				scanf("%d",&x[i][j]);
				if(x[i][j]==0||x[i][j]==-1)
                                     {a[i]=j;break;}   //a[i]???i??????
			}
			if(x[i][j]==-1) {m=i;break;} //m??????????
		}
		for(i=0;i<m;i++)
		{
			for(j=0;j<a[i];j++)
			{
				for(k=0;k<a[i];k++)
				{
					if((float)x[i][k]/(float)x[i][j]==2.0) b[i]++;   //b[i]???i???????????
				}
			}
		}
		for(i=0;i<m;i++)
			printf("%d\n",b[i]);
		return;
}
int main(){
    int c,a[20],t,sum;
    while(1){
        t=sum=0;
        while(1){
           scanf("%d",&c);
           if(!c || c==-1)break;
           a[t++]=c;               
        }
        if(c==-1)break;
        for(int i=0;i<t;i++)
        for(int j=0;j<t;j++)
            if(a[j]==a[i]*2)sum++;
        printf("%d\n",sum);
    }
    return 0;
}
int main()
{
	int a[16], i, b, j, k, m;
	a[1]=1;
	while (a[1]!=-1)
	{
		i=1;
		m=0;
		while (cin >> b)
		{
			a[i]=b;
			if(a[i]==0||a[i]==-1)
			break;
			i=i+1;
		}
		for (j=1;j<=i-1;j++)
		{
			for (k=1;k<=i-1;k++)
			{
				if (a[j]==2*a[k])
					m++;
			}
		}
		if (a[i]!=-1)
		cout << m << endl;
	}
	return 0;
}
int main()
{
	int a[15],i=1,j,k,*p,count=0;
    scanf("%d",&a[0]);
	while(a[0]!=-1)
	{
		for(i=1;;i++)
		{
			scanf("%d",&a[i]);
		if(a[i]==0)
			break;
		}
	    p=a;
	    for(j=0;j<i;j++)
		{
		  for(k=0;k<i;k++)
		  {
			if(p[j]==p[k]*2)
				count++;
		  } 
		}
	    printf("%d\n",count);
		count=0;
	    scanf("%d",&a[0]);
	}
	return 0;
}
int main()
{
	int a[16], i, j, k , num;
	do
	{
		num = 0;
		k = 0;
		cin >> a[0];
		if (a[0] == -1) break; 
		for (i = 1; i <= 15; i ++)
		{
			cin >> a[i];
			if (a[i] == 0) break;
			k ++;
		}
		for (i = 0; i <= k; i ++)
			for (j = 0; j <= k; j ++)
				if (a[i] == 2 * a[j])
					num ++;
		cout << num << endl;
	} while(1);
	return 0;
}
int main()
{
int n,a[15],m=0,s,h,t;
scanf("%d",&t);
while((t+1)!=0)
{
for(n=0,s=0;t!=0;n++)
a[n]=t,s++,scanf("%d",&t);
for(n=0;n<s;n++)
{
	for(h=0;h<s;h++)
	{
		if(a[n]==2*a[h])m++;
	}
}
printf("%d\n",m);
m=0;	
scanf("\n%d",&t);
}
return 0;
}