#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool only(int a) {
  while (a % 2 == 0) {
    a /= 2;
  }
  while (a % 3 == 0) {
    a /= 3;
  }
  return a == 1;
}
int main() {
  int m;
  cin >> m;
  vector<int> to(m, 0);
  int mx = 0;
  for (int i = 0; i < to.size(); i++) {
    cin >> to[i];
    mx = max(mx, to[i]);
  }
  bool pod = true;
  for (int i : to) {
    int g = gcd(mx, i);
    int tmx = mx / g;
    int ti = i / g;
    if (!only(ti) || !only(tmx)) {
      pod = false;
      break;
    }
  }
  if (pod)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
