#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int i;
  for (int i = 0; i < n; i++) {
    while (v[i] % 2 == 0) {
      v[i] /= 2;
    }
    while (v[i] % 3 == 0) {
      v[i] /= 3;
    }
  }
  cout << endl;
  vector<long long int>::iterator it = min_element(v.begin(), v.end());
  vector<long long int>::iterator it2 = max_element(v.begin(), v.end());
  if (*it == *it2)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
