#include <bits/stdc++.h>
const char en = '\n';
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> V(n + 47, 0);
  long long ma2 = 0;
  long long ma3 = 0;
  vector<long long> X;
  for (int i = 0; i < n; i++) {
    cin >> V[i];
    long long p2 = 0, p3 = 0;
    long long k = V[i];
    while (k % 2 == 0) {
      p2++;
      k /= 2;
    }
    while (k % 3 == 0) {
      p3++;
      k /= 3;
    }
    X.push_back(k);
  }
  sort(X.begin(), X.end());
  if (X[0] == X[n - 1])
    cout << "Yes" << en;
  else
    cout << "No" << en;
}
