#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long double EPS = 1e-11;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = (0); i < (int)(n); ++i) scanf("%d", &a[i]);
  for (int i = (0); i < (int)(n); ++i) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
    }
    while (a[i] % 3 == 0) {
      a[i] /= 3;
    }
  }
  bool flag = true;
  for (int i = (0); i < (int)(n); ++i)
    if (a[i] != a[0]) flag = false;
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
