#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using ld = long double;
mt19937 rnd(time(nullptr));
lli GCD(lli a, lli b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
lli LCM(lli a, lli b) { return a / GCD(a, b) * b; }
inline void Solve() {
  lli n = 0;
  cin >> n;
  vector<lli> data(n);
  for (auto &it : data) {
    cin >> it;
    while (it % 2 == 0) it /= 2;
    while (it % 3 == 0) it /= 3;
  }
  for (lli i = 1; i < n; i++) {
    if (data[i] != data[i - 1]) {
      cout << "No";
      return;
    }
  }
  cout << "Yes";
}
signed main() {
  cout << fixed << setprecision(20);
  Solve();
  return 0;
}
