#include <bits/stdc++.h>
using namespace std;
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                       {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int gcD(int a, int b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
const int MAXN = 2e5 + 10;
int a[MAXN];
int N;
int main() {
  scanf("%d", &N);
  int g = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    g = gcD(a[i], g);
  }
  for (int i = 0; i < N; i++) {
    a[i] /= g;
    while ((a[i] & 1) == 0) a[i] = a[i] >> 1;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != 1) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
