#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc;
  cin >> tc;
  vector<long long int> v;
  while (tc--) {
    long long int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  int d = 0;
  bool flag = 1;
  for (int i = 0; i < v.size(); i++) {
    while (v[i] % 2 == 0) {
      v[i] /= 2;
    }
    while (v[i] % 3 == 0) {
      v[i] /= 3;
    }
    if (i == 0) {
      d = v[i];
    } else if (d != v[i]) {
      flag = 0;
      break;
    }
  }
  if (flag == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
