#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, x = -1;
  bool ok = true;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    while (a % 3 == 0) a /= 3;
    while (a % 2 == 0) a /= 2;
    if (x == -1) x = a;
    if (x != a) ok = false;
  }
  if (ok)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
