#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
long long int a, b, i, d[1011000], j, k, n, m, timer = 0, l, r, x, y;
long long int c[1011000], cnt = 0, fl = 0, a2, a3 = -1000000, ans = 0;
long long int GCD(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
};
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> c[i];
    while (c[i] % 2ll == 0) {
      c[i] /= 2ll;
    }
    while (c[i] % 3ll == 0) {
      c[i] /= 3ll;
    }
    if (i == 0) k = c[i];
    if (i != 0 && k != c[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
