#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0 or a == 0) return a + b;
  return gcd(b, a % b);
}
void solve() {
  int n;
  cin >> n;
  int ar[n];
  long long int gc;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    if (i == 0) {
      gc = ar[i];
    } else {
      gc = gcd(ar[i], gc);
    }
  }
  for (int i = 0; i < n; i++) {
    ar[i] /= gc;
    while (ar[i] % 2 == 0) {
      ar[i] /= 2;
    }
    while (ar[i] % 3 == 0) {
      ar[i] /= 3;
    }
    if (ar[i] != 1) {
      cout << "No";
      return;
    }
  }
  cout << "Yes";
  return;
}
int main() {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  int TC = 1;
  for (int ZZ = 1; ZZ <= TC; ZZ++) {
    solve();
    cout << endl;
  }
  return 0;
}
