#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double eps = 1e-8;
const int nm = 300005;
int n, m, k, t;
long long res;
int a[nm];
char s[nm];
int main() {
  int i, j, x, y, z, u, v, w;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != a[1]) break;
  }
  if (i <= n)
    printf("No");
  else
    printf("Yes");
  return 0;
}
