http://acm.hdu.edu.cn/showproblem.php?pid=1303
/*
2011-9-14
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class HDU_1303 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
Double[] d = new Double[18];
int index = 0;
int cnt = 0;
while(in.hasNext()){
Double n = in.nextDouble();
if( n == -1){
break;
}
else if(n == 0){
Arrays.sort(d,0,index,new DoubleComparator());
for(int i = 0; i < index; i++){
for(int j = i+1; j < index; j++){
if(d[i] * 2 == d[j])cnt++;
}
}
System.out.println(cnt);
index = 0;
cnt = 0;
}else{
d[index++] = new Double(n);
}
}
}
private static class DoubleComparator implements Comparator<Double>{
@Override
public int compare(Double d1, Double d2) {
return (int) (d1 - d2);
}
}
}