#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, i;
  cin >> n;
  int inp, k, temp, temp2;
  cin >> inp;
  int x = 0, hcf = inp;
  for (i = 1; i < n; i++) {
    temp2 = hcf;
    cin >> inp;
    hcf = gcd(hcf, inp);
    inp = inp / hcf;
    temp2 = temp2 / hcf;
    temp = inp;
    while (temp % 2 == 0) {
      temp /= 2;
    }
    while (temp % 3 == 0) temp /= 3;
    while (temp2 % 2 == 0) {
      temp2 /= 2;
    }
    while (temp2 % 3 == 0) temp2 /= 3;
    if (temp == 1 && temp2 == 1) {
      x = 0;
      continue;
    } else {
      x = 1;
      break;
    }
  }
  if (x == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
int gcd(int a, int b) {
  for (;;) {
    if (a == 0) return b;
    b %= a;
    if (b == 0) return a;
    a %= b;
  }
}
