#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long a, long b) { return ((a * b) / gcd(a, b)); }
long long a[100000];
int main() {
  long long i, j, k, l, m, n, maxx = 0, g = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
    }
    while (a[i] % 3 == 0) {
      a[i] /= 3;
    }
  }
  sort(a, a + n);
  if (a[0] == a[n - 1])
    cout << "Yes" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
