#include <bits/stdc++.h>
long long n, flag;
long long x, t;
long long a[100010];
long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
using namespace std;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  t = a[1];
  for (int i = 2; i <= n; i++) t = gcd(t, a[i]);
  for (int i = 1; i <= n; i++) a[i] = a[i] / t;
  flag = 1;
  for (int i = 1; i <= n; i++) {
    x = a[i];
    while ((x & 1) == 0) x = x >> 1;
    while ((x % 3) == 0) x /= 3;
    if (x > 1) {
      flag = 0;
      break;
    }
  }
  if (flag)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
