#include <bits/stdc++.h>
using namespace std;
int n;
const int s = 1e5 + 10;
int a[s];
int main(int argc, char** argv) {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (a[i] % 3 == 0) a[i] = a[i] / 3;
    while (a[i] % 2 == 0) {
      a[i] = a[i] / 2;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] != a[i + 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
