#include <bits/stdc++.h>
using namespace std;
long long MOD = int(1e9) + 7;
int debug = 1;
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  int gc = ar[0];
  for (int i = 0; i < n; i++) {
    gc = gcd(gc, ar[i]);
  }
  for (int i = 0; i < n; i++) {
    ar[i] /= gc;
  }
  for (int i = 0; i < n; i++) {
    while (ar[i] % 2 == 0) {
      ar[i] /= 2;
    }
    while (ar[i] % 3 == 0) {
      ar[i] /= 3;
    }
    if (ar[i] != 1) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
