#include <bits/stdc++.h>
const int maxx = 1e6 + 100;
const double eps = 1e-10;
const long long mod = 1e9 + 1;
const int inf = 0x3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
long long n, m, T;
long long l, r, ans;
long long a[maxx + 5];
int main() {
  int i, j, k;
  while (cin >> n) {
    bool ok = true;
    for (i = 0; i < n; i++) cin >> a[i];
    l = a[0];
    for (i = 0; i < n; i++) {
      r = a[i];
      while (1) {
        if (r == 1) break;
        if (r % 2 == 0)
          r /= 2ll;
        else if (r % 3 == 0)
          r /= 3ll;
        else
          break;
      }
      a[i] = r;
    }
    for (i = 0; i < n; i++)
      if (a[i] == a[0]) m++;
    if (m == n)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
