#include <bits/stdc++.h>
using namespace std;
long long gcd(long long p, long long q) { return q ? gcd(q, p % q) : p; }
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  long long g = a[0];
  for (int i = 1; i < N; i++) g = gcd(g, a[i]);
  for (int i = 0; i < N; i++) a[i] /= g;
  for (int i = 0; i < N; i++)
    while (a[i] % 2 == 0 || a[i] % 3 == 0)
      if (a[i] % 2 == 0)
        a[i] /= 2;
      else if (a[i] % 3 == 0)
        a[i] /= 3;
  for (int i = 0; i < N; i++)
    if (a[i] != 1) {
      cout << "No";
      return 0;
    }
  cout << "Yes";
  return 0;
}
