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