#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << '{';
  for (int i = (0), __i = (((int)(vec).size())); i < __i; i++) {
    os << vec[i];
    if (i + 1 != ((int)(vec).size())) os << ',';
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &par) {
  os << '(' << par.first << ',' << par.second << ')';
  return os;
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
template <class T>
T sqr(T x) {
  return x * x;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int del = -1;
  for (int i = (0), __i = (n); i < __i; i++) {
    int a;
    cin >> a;
    while (!(a & 1)) a >>= 1;
    while (!(a % 3)) a /= 3;
    if (del == -1)
      del = a;
    else if (del != a) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
