#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10;
int prime[1000010];
bool isprime[N];
int nprime;
void sieve() {
  nprime = 0;
  memset(isprime, true, sizeof(isprime));
  isprime[1] = false;
  for (int i = 2; i < N; i++) {
    if (isprime[i]) {
      prime[nprime++] = i;
      for (int j = 2; i * j < N; j++) isprime[i * j] = false;
    }
  }
}
long long int PrimeFactors(long long int n) {
  long long int cnt = 0, sum = 1;
  for (int i = 0; prime[i] * prime[i] <= n and i < nprime; i++) {
    cnt = 0;
    while (n % prime[i] == 0) {
      cnt++;
      n /= prime[i];
    }
    sum *= (cnt + 1);
  }
  if (n > 1) sum *= 2;
  return sum;
}
long long int TrailingZeros(long long int n) {
  long long int cnt = 0;
  for (long long int i = 5; n / i >= 1; i *= 5) cnt += n / i;
  return cnt;
}
bool cmp(string i, string j) { return i + j > j + i; }
string ItoS(long long int n) {
  stringstream a;
  a << n;
  return a.str();
}
long long int BigMod(long long int a, long long int b, long long int m) {
  if (!b) return 1;
  long long int x = BigMod(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2) x = (x * a) % m;
  return x;
}
long long int StoI(string s) {
  long long int sum = 0;
  for (long long int i = 0; i < s.size(); i++) {
    s[i] -= '0';
    sum = sum * 10 + s[i];
  }
  return sum;
}
long long int GCD(long long int a, long long int b) {
  long long int t;
  while (a) {
    t = a;
    a = b % a;
    b = t;
  }
  return b;
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / GCD(a, b);
}
long long int _pow(long long int base, long long int exp) {
  long long int result = 1;
  while (exp) {
    if (exp & 1) result *= base;
    exp >>= 1;
    base *= base;
  }
  return result;
}
long long int binary_decimal(long long int n) {
  long long int decimal = 0, i = 0, rem;
  while (n != 0) {
    rem = n % 10;
    n /= 10;
    decimal += rem * pow(2, i);
    ++i;
  }
  return decimal;
}
int main() {
  long long int n, a;
  set<long long int> st;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    cin >> a;
    while (a % 2 == 0 and a > 0) a /= 2;
    while (a % 3 == 0 and a > 0) a /= 3;
    st.insert(a);
  }
  if (st.size() == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
