#include <bits/stdc++.h>
using namespace std;
vector<long long> p;
bitset<10000010> bs;
vector<long long> func(long long n) {
  long long idx = 0, pf = p[idx];
  vector<long long> vec;
  while (pf * pf <= n) {
    while (n % pf == 0) {
      vec.push_back(pf);
      n /= pf;
    }
    pf = p[++idx];
  }
  if (n != 1) {
    vec.push_back(n);
  }
  return vec;
}
long long n, m;
vector<long long> v;
int main(void) {
  long long ss = 10000000;
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i <= ss; i++) {
    if (bs[i]) {
      for (long long j = i * i; j <= ss; j += i) {
        bs[j] = 0;
      }
      p.push_back(i);
    }
  }
  v.clear();
  cin >> n;
  m = 0;
  long long a;
  for (int x = 0; x < n; x++) {
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
    }
    while (a % 3 == 0) {
      a /= 3;
    }
    m = max(m, a);
    v.push_back(a);
  }
  vector<long long> fat = func(m);
  bool ok = true;
  long long at;
  for (int x = 0; x < n; x++) {
    at = v[x];
    for (int y = 0; y < fat.size(); y++) {
      if (at % fat[y] == 0) {
        at /= fat[y];
      } else {
        ok = false;
        break;
      }
    }
    if (!ok) break;
    if (at != 1) {
      ok = false;
      break;
    }
  }
  if (ok)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
