#include <bits/stdc++.h>
using namespace std;
int num(int n) {
  while (n % 2 == 0) n /= 2;
  while (n % 3 == 0) n /= 3;
  return n;
}
int main() {
  int n, i, a, k;
  cin >> n >> a;
  k = num(a);
  for (i = 1; i < n; i++) {
    cin >> a;
    if (num(a) != k) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
