#include <bits/stdc++.h>
using namespace std;
int a[100000 + 10], n, i, x;
bool wrong;
int gcd(int a, int b) {
  if (a == 0 || b == 0) return a + b;
  if (a > b)
    return gcd(b, a % b);
  else
    return gcd(a, b % a);
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    x = gcd(x, a[i]);
  }
  for (i = 0; i < n; i++) {
    a[i] /= x;
    while (a[i] % 3 == 0) a[i] /= 3;
    while (a[i] % 2 == 0) a[i] /= 2;
    if (a[i] == 1) continue;
    wrong = true;
    break;
  }
  if (!wrong)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
