#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  if (a < b) {
    swap(a, b);
  }
  T t;
  while (b > 0) {
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <class T>
T gcdL(vector<T>& v) {
  int l = v.size();
  if (l == 1) return v[0];
  T g = gcd(v[0], v[1]);
  for (int i = 2; i < l; i++) {
    g = gcd(g, v[i]);
  }
  return g;
}
long long foo(long long x) {
  while (x % 2 == 0) x /= 2;
  while (x % 3 == 0) x /= 3;
  return x;
}
bool ok(vector<long long>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    v[i] = foo(v[i]);
  }
  for (int i = 0; i < (int)v.size(); i++) {
    if (v[i] == 1)
      continue;
    else
      return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(10);
  long long n, x;
  vector<long long> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  long long g = gcdL(v);
  for (int i = 0; i < n; i++) {
    v[i] /= g;
  }
  if (ok(v))
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
