#include <bits/stdc++.h>
using namespace std;
unsigned long long int gcd(unsigned long long int a, unsigned long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
vector<unsigned long long int> ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  unsigned long long int n;
  cin >> n;
  unsigned long long int a[n], h, l;
  cin >> a[0];
  l = a[0];
  for (unsigned long long int i = 1; i < n; ++i) {
    cin >> a[i];
    l = gcd(l, a[i]);
  }
  for (unsigned long long int i = 0; i < n; ++i) {
    unsigned long long int tmp = a[i] / l;
    while (tmp % 2 == 0) tmp /= 2;
    while (tmp % 3 == 0) tmp /= 3;
    if (tmp > 1) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
