#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
struct debugger {
  static void call(const char* it) {}
  template <typename T, typename... valT>
  static void call(const char* it, T val, valT... rest) {
    string var = "";
    for (; *it && *it != ','; it++)
      if (*it != ' ') var += *it;
    cerr << var << '=' << val << " ";
    call(++it, rest...);
  }
};
const int MAX = 2e5 + 10;
int main() {
  int n;
  cin >> n;
  int A[n];
  for (int i = 0; i < (int)n; i++) cin >> 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 ok = 1;
  for (int i = (int)1; i < (int)n; i++)
    if (A[i] != A[0]) ok = 0;
  if (ok)
    cout << "Yes\n";
  else
    cout << "No\n";
}
