Deal!
Homer Simpson was very busy watching TV when Bart asked to play outside. It was pretty hot outside and Homer was much into playing.
He knew that Bart didn’t like math and decided to keep him busy with a task so that he could finish TV show and visit Moe. So he decided to keep Bart busy with something else.
“Here is a deal little boy. I will give a math problem. If you can solve it, we are going to Disney Land. If you don’t find the right solution, we are not going outside until the end of April.”
“Here’s the task” says Homer.
"You are given a list of integers. On a single turn, you can double (i.e., multiply by 2) any element of list. You may double the same element more than once, if you wants to. Your task is to obtain an array in which all elements are equal. Return "YES" (quotes for clarity) if it is possible to do that and "NO" otherwise."
Since Bart knew no programming language and didn’t like math, he understood that he will not be able to solve the problem. But suddenly he remembers you. He knows you spend lots of time solving math problem. He decides the task will be pretty simple for and challenges his dad: “if I finish the task in less than hour, you will take me to Disney and buy me ice cream as many as I want.”
“Deal” says Homer.
Input
The first line is n (1 ≤ n ≤ 50) which holds the number of elements in a list. The second line is a list of n elements. Each element of the list will be smaller than or equal to 10^9
.
Output
You need to print “YES” if it is possible to transfer all numbers to the same integer. If it is not possible, print “NO”.