#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(vector<T> someVector) {
  cout << "print\n";
  for (T element : someVector) {
    cout << element << " ";
  }
  cout << "\n";
}
template <typename T>
void print(vector<vector<T> > someVector) {
  cout << "print\n";
  for (vector<T> currentVector : someVector) {
    cout << "\n";
    for (T element : currentVector) {
      cout << element << " ";
    }
  }
}
int iRead() {
  int x;
  cin >> x;
  return x;
}
long long lRead() {
  long long x;
  cin >> x;
  return x;
}
void read() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
int func(int a) {
  while (a % 2 == 0) {
    a /= 2;
  }
  while (a % 3 == 0) {
    a /= 3;
  }
  return a;
}
int main() {
  read();
  int n = iRead();
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    v.push_back(func(iRead()));
  }
  for (int i = 1; i < v.size(); ++i) {
    if (v[i] != v[0]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
