#include <bits/stdc++.h>
using namespace std;
int cmp(const void *a, const void *b) { return *(int *)b - *(int *)a; }
int g(int a, int b) {
  if (b == 0)
    return a;
  else
    return g(b, a % b);
}
int a[100010];
int main() {
  int n, i, flag = 0, j, gcd;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  gcd = a[0];
  for (i = 1; i < n; i++) gcd = g(gcd, a[i]);
  for (i = 0; i < n; i++) {
    j = a[i] / gcd;
    while (j % 2 == 0) j /= 2;
    while (j % 3 == 0) j /= 3;
    if (j != 1) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
