/**
 * @file   1000012834_002homework.cpp
 * @author ???
 * @date   2010-11-3
 * @description 
 *         ???????1134 ??  
 */
int main()
{										//?????
	int i , j , ii , t , flag;			//???????????????????
	int a[ 2000 ];							//????
	while (1)							//?????-1????????
	{
		t = 0;							//?????
		flag = 1;
		i = 1;
		while (flag == 1)				//?????????0????
		{
			cin >> a[ i ++];			//????????
			if (a[ i - 1 ] == 0)		//????????????
				flag = 0;
			else
				if (a[ i - 1 ] == -1)	//????-1??????????
					return 0;
		}
	/*	i = 1;
	while ((a[i] = cin.get()) != '-1')
	{
          a[i] -=  48;
		i ++;
		t = 0;
		cin.get();
		while ((a[i++] = cin.get()) != '0')
		{	a[i - 1] -= 48;
			cin.get();
		}
		
		**/
			i -= 1;							//????i????????????0
			for (j = 1; j < i; j++)		//??????????,????i++???????-1
			{
				if (a[ j ] % 2 == 0)	//???????????
				{
					for (ii = 1; ii < i; ii++)	//????????????????
					{

						//??????????????
						if (a[ ii ] * 2 == a[ j ])
						t ++;						//???????????1
					}
				}
			}
			cout << t << endl;			//?????????????
	}
	
	return 0;
}										//?????
