#include <bits/stdc++.h>
using namespace std;
int temp;
int calHcf(int x, int y) {
  if (y > x) return calHcf(y, x);
  if (y == 0) return x;
  return calHcf(y, x % y);
}
bool chk(int x) {
  while (x % 2 == 0) x = x / 2;
  while (x % 3 == 0) x = x / 3;
  if (x == 1) return true;
  return false;
}
int main() {
  int i, n, a[100005];
  cin >> n;
  for (i = 0; i < n; ++i) cin >> a[i];
  int hcf = calHcf(a[0], a[1]);
  for (i = 2; i < n; ++i) hcf = calHcf(hcf, a[i]);
  for (i = 0; i < n; ++i) a[i] = a[i] / hcf;
  for (i = 0; i < n; ++i)
    if (chk(a[i]) == false) {
      cout << "No";
      return 0;
    }
  cout << "Yes";
}
