#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, n, fst, dvs;
  cin >> n >> fst;
  while (fst % 2 == 0) fst /= 2;
  while (fst % 3 == 0) fst /= 3;
  dvs = fst;
  for (int i = 1; i < n; ++i) {
    cin >> a;
    while (a % 2 == 0) a /= 2;
    while (a % 3 == 0) a /= 3;
    if (a == dvs)
      continue;
    else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
