#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
class LittleElephantAndDouble{
public:
string getAnswer(vector<int> A){
sort(A.begin(),A.end());
int max=A[A.size()-1];
for(int i=0;i<A.size()-1;i++){
if(max!=A[i] && (max%A[i]!=0 || !isPowerOf2(max/A[i]))){
return "NO";
}
}
return "YES";
}
bool isPowerOf2(int v){
while(v>1){
if(v%2==0)
v=v/2;
else
return false;
}
return true;
}
};
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
class LittleElephantAndDouble{
public:
string getAnswer(vector<int> A){
sort(A.begin(),A.end());
int max=A[A.size()-1];
for(int i=0;i<A.size()-1;i++){
if(max!=A[i] && (max%A[i]!=0 || !isPowerOf2(max/A[i]))){
return "NO";
}
}
return "YES";
}
bool isPowerOf2(int v){
while(v>1){
if(v%2==0)
v=v/2;
else
return false;
}
return true;
}
};