#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mod(T a, T b) {
  T ans;
  if (b == 0)
    return -1;
  else
    ans = (a < 0 ? mod(((a % b) + b), b) : a % b);
  return ans;
}
long long fast_exp(long long base, long long n, long long M) {
  long long ans = 1;
  while (n) {
    if (n % 2 == 1) ans = (ans * base) % M;
    base = (base * base) % M;
    n = n >> 1;
  }
  return ans % M;
}
template <typename Out>
void split(const string &s, char delim, Out result) {
  stringstream ss;
  ss.str(s);
  string item;
  while (getline(ss, item, delim)) {
    *(result++) = item;
  }
}
vector<string> split(const string &s, char delim) {
  vector<string> elems;
  split(s, delim, back_inserter(elems));
  return elems;
}
long long func(long long a) {
  while ((a % 2 == 0 || a % 3 == 0) and a != 0) {
    if (a % 2 == 0) a /= 2;
    if (a % 3 == 0) a /= 3;
  }
  return a;
}
void solve() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v[i] = func(v[i]);
  }
  long long eq = v[0];
  bool flag = true;
  for (int i = 1; i < n; i++) {
    if (v[i] != eq) {
      flag = false;
      break;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
