#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long a[100100];
int main() {
  int n;
  cin >> n;
  long long g = 0;
  for (int(i) = (0); (i) < (int)(n); ++(i)) {
    cin >> a[i];
    g = gcd(a[i], g);
  }
  int yes = 1;
  for (int(i) = (0); (i) < (int)(n); ++(i)) {
    a[i] /= g;
    while (a[i] && a[i] % 2LL == 0) a[i] /= 2LL;
    while (a[i] && a[i] % 3LL == 0) a[i] /= 3LL;
    yes &= (a[i] == 1LL);
  }
  cout << (yes ? "Yes" : "No") << endl;
  return 0;
}
