#include <bits/stdc++.h>
using namespace std;
int removeValidFactors(int x) {
  while (x % 3 == 0) {
    x /= 3;
  }
  while (x % 2 == 0) {
    x /= 2;
  }
  return x;
}
int main() {
  int n;
  while (cin >> n) {
    vector<int> v(n);
    set<int> unique;
    for (int& i : v) {
      cin >> i;
    }
    for (int i = 0; i < n; ++i) {
      int x = removeValidFactors(v[i]);
      unique.insert(x);
    }
    cout << ((int)unique.size() == 1 ? "Yes" : "No") << '\n';
  }
  return 0;
}
