#include <bits/stdc++.h>
using namespace std;
long long check(long long a) {
  while (a > 0 && (a & 1) == 0) a >>= 1;
  while (a > 0 && a % 3 == 0) a /= 3;
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  int temp;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      temp = check(a[i]);
    else if (temp != check(a[i])) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
