#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
void disp(T& x) {
  for (typename T::iterator it = x.begin(); it != x.end(); ++it)
    cout << *it << ' ';
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  int x;
  cin >> x;
  while (x % 2 == 0) x /= 2;
  while (x % 3 == 0) x /= 3;
  for (int i = 1; i < n; ++i) {
    int y;
    scanf("%d", &y);
    while (y % 2 == 0) y /= 2;
    while (y % 3 == 0) y /= 3;
    if (x != y) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
