#include <bits/stdc++.h>
using namespace std;
const int nmax = 100005;
const int mod = 1e9 + 7;
const long long inf = 3 * 1e12;
const double EPS = 1e-6;
long long a[nmax];
long long gcd(long long a, long long b) { return (!a ? b : gcd(b % a, a)); }
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  long long cur = a[1];
  for (int i = 2; i <= n; ++i) {
    cur = gcd(cur, a[i]);
  }
  for (int i = 1; i <= n; ++i) a[i] /= cur;
  for (int i = 1; i <= n; ++i) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] == 1) continue;
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  return 0;
}
