#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (a[0] % 2 == 0) {
    a[0] /= 2;
  }
  while (a[0] % 3 == 0) {
    a[0] /= 3;
  }
  bool flag = 1;
  for (int i = 1; i < n; i++) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != a[0]) {
      flag = 0;
      break;
    }
  }
  if (flag)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}
