#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
bool isvowel(char ch) {
  ch = tolower(ch);
  return ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u';
}
int main() {
  long long N;
  cin >> N;
  set<long long> St;
  for (int i = 0; i < N; i++) {
    long long temp;
    cin >> temp;
    for (int j = 0; temp % 2 == 0 and temp; j++) temp /= 2;
    for (int j = 0; temp % 3 == 0 and temp; j++) temp /= 3;
    St.insert(temp);
  }
  St.size() == 1 ? deb("Yes") : deb("No");
  ;
}
