#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[1010];
  int u;
  for (u = 0; u < n; u++) {
    long long kk;
    cin >> kk;
    while (kk % 387420489 == 0) {
      kk = kk / 387420489;
    }
    while (kk % 33554432 == 0) {
      kk = kk / 33554432;
    }
    while (kk % 3 == 0) {
      kk = kk / 3;
    }
    while (kk % 2 == 0) {
      kk = kk / 2;
    }
    if (u == 0) a[0] = kk;
    if (a[0] != kk) {
      cout << "No" << endl;
      break;
    }
    if (u == n - 1) cout << "Yes" << endl;
  }
}
