#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = int(1e5 + 50);
int a[N];
inline int gcd(int a, int b) {
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int main() {
  int n;
  scanf("%d", &n);
  scanf("%d", &a[0]);
  int g = a[0];
  for (int i = 1; i < n; i++) {
    scanf("%d", &a[i]);
    g = gcd(g, a[i]);
  }
  bool ok = true;
  for (int 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) {
      ok = false;
      break;
    }
  }
  if (ok) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}
