#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
inline void reduce(uint32_t& n) {
  n >>= __builtin_ctz(n);
  while (n % 3 == 0) {
    n /= 3;
  }
}
void bear(istream& in, ostream& out) {
  int n;
  register uint32_t temp, first, reduced_first;
  in >> n;
  in >> first;
  reduced_first = first;
  reduce(reduced_first);
  for (int i = 0; i < n - 1; ++i) {
    in >> temp;
    reduce(temp);
    if (temp != reduced_first) {
      out << "No" << endl;
      return;
    }
  }
  out << "Yes" << endl;
}
int main(int argc, char* argv[]) {
  bear(cin, cout);
  return 0;
}
