#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  return (b > a) ? gcd(b, a) : (b == 0) ? a : gcd(b, a % b);
}
int bitcount(int a) { return (a != 0) ? bitcount(a & (a - 1)) + 1 : 0; }
long long bigmod(long long num, long long pow, long long prime) {
  if (pow == 0ll) return 1ll;
  long long ans = bigmod(num, pow / 2ll, prime);
  ans = (ans * ans) % prime;
  if (pow % 2ll) ans = (ans * num) % prime;
  return ans;
}
int n, a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int g = a[0];
  for (int i = 1; i < n; i++) g = gcd(g, a[i]);
  for (int i = 0; i < n; i++) a[i] /= g;
  bool fail = 0;
  for (int i = 0; i < n; i++) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] > 1) {
      fail = 1;
      break;
    }
  }
  if (fail) {
    cout << "No\n";
  } else {
    cout << "Yes\n";
  }
  return 0;
}
