#include <bits/stdc++.h>
int n, a[100001], i, j, k, g[100001];
int check_div(int a) {
  while (a % 2 == 0) {
    a = a / 2;
  }
  while (a % 3 == 0) {
    a = a / 3;
  }
  if (a == 1)
    return 1;
  else
    return 0;
}
int gcd(int p, int q) {
  if (q == 0) return p;
  return gcd(q, p % q);
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  k = a[0];
  for (i = 0; i < n; i++) k = gcd(k, a[i]);
  for (i = 0; i < n; i++) {
    g[i] = a[i] / k;
    if (0 == check_div(g[i])) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
