#P1972. Integersdouble
Integersdouble
You are given an array A that contains N integers. On a single turn, you can double (i.e., multiply by 2) any element of A. You may double the same element more than once, if you want to. Now,You want to obtain an array in which all elements are equal. Please printf "YES" (quotes for clarity) if it is possible to do that and "NO" otherwise.
Input
There are multiple test cases.
Each test case begins with an integer N(N≤10000),represents the array contains N elements.The next line contains N integers,the ith integer represents A[i],(A[i]≤10000000).
Each test case begins with an integer N(N≤10000),represents the array contains N elements.The next line contains N integers,the ith integer represents A[i],(A[i]≤10000000).
Output
Printf "YES" if it is possible to do that and "NO" otherwise.
Sample Input
2
1 2
3
1 2 3
4
2 4 8 16
7
2 4 6 89 265 56 38
Sample Output
YES
NO
YES
NO