#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128777216")
using namespace std;
const long long LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
void prepare(string s) {
  if (s.length() != 0) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
  }
}
const int NMAX = 100010;
int n;
int a[NMAX];
void read() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &a[i]);
}
void solve() {
  for (int i = 0; i < (int)(n); i++) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
  }
  bool ok = true;
  for (int i = 0; i < (int)(n); i++)
    if (a[i] != a[0]) ok = false;
  if (ok)
    printf("Yes\n");
  else
    printf("No\n");
}
int main() {
  prepare("");
  read();
  solve();
  return 0;
}
