#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  while (t--) {
    long long n, i, x, y, p, l, k, z;
    cin >> n;
    long long a[n + 4];
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) {
      while (a[i] % 2 == 0) {
        a[i] = a[i] / 2;
      }
      while (a[i] % 3 == 0) {
        a[i] = a[i] / 3;
      }
    }
    sort(a, a + n);
    if (a[0] == a[n - 1])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
