#include <bits/stdc++.h>
using namespace std;
int static const N = 100010;
void sort(int *a, int d) {
  priority_queue<int> q;
  for (int i = 0; i < d; i++) q.push(a[i]);
  for (int i = 0; i < d; i++) {
    a[i] = q.top();
    q.pop();
  }
}
int nzd(int a, int b) {
  if (a % b == 0) return b;
  return nzd(b, a % b);
}
int n, a[N];
int radi() {
  for (int i = 0; i < n; i++) {
    while (a[i] > 1 && a[i] % 2 == 0) a[i] /= 2;
    while (a[i] > 1 && a[i] % 3 == 0) a[i] /= 3;
    if (a[i] > 1) {
      printf("No\n");
      return 1;
    }
  }
  printf("Yes\n");
  return 1;
}
int main() {
  scanf("%i", &n);
  for (int i = 0; i < n; i++) scanf("%i", &a[i]);
  int nd = a[0];
  for (int i = 1; i < n; i++) nd = nzd(max(nd, a[i]), min(nd, a[i]));
  for (int i = 0; i < n; i++) a[i] /= nd;
  int q = radi();
  return 0;
}
