#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    while (v[i] % 2 == 0) v[i] /= 2;
    while (v[i] % 3 == 0) v[i] /= 3;
  }
  sort(v.begin(), v.end());
  if (v[0] == v[v.size() - 1])
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
