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