#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt = 0;
  string s;
  int n;
  cin >> n;
  vector<long long int> ar(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < n; i++) {
    while (ar[i] % 2 == 0) {
      ar[i] = ar[i] / 2;
    }
    while (ar[i] % 3 == 0) {
      ar[i] = ar[i] / 3;
    }
  }
  bool flag = true;
  for (int i = 0; i < n - 1; i++) {
    if (ar[i] != ar[i + 1]) {
      flag = false;
      cout << "No" << endl;
      break;
    }
  }
  if (flag == true) cout << "Yes" << endl;
  return 0;
}
