for _ in xrange(input()): n=input() count=0 lst=map(int, raw_input().split(" ")) i=0 while 1: if lst[i]*2 in lst: count+=1 del(lst[lst.index(lst[i]*2)]) i+=1 print count
2 2 1 2 3 1 2 4
Standard output is empty
Traceback (most recent call last): File "prog.py", line 7, in <module> IndexError: list index out of range