#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
const long long LINF = numeric_limits<long long>::max();
const double DINF = numeric_limits<double>::max();
double eps = 1e-2;
const int MAXN = 1e4 + 5;
void solve() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    while (a[i] % 2 == 0 || a[i] % 3 == 0) {
      if (a[i] % 3 == 0) a[i] /= 3;
      if (a[i] % 2 == 0) a[i] /= 2;
    }
  }
  bool ok = true;
  for (int i = 0; i < n - 1; ++i)
    if (a[i] != a[i + 1]) ok = false;
  cout << (ok ? "Yes" : "No");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int k = 0; k < t; ++k) {
    solve();
  }
  return 0;
}
