#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int verify(long long n) {
  while (n % 2 == 0) n /= 2;
  while (n % 3 == 0) n /= 3;
  return n == 1;
}
int main() {
  int n, a, b, i, g;
  scanf("%d%d%d", &n, &a, &b);
  for (i = 1; i < n; i++) {
    g = gcd(a, b);
    if (!verify(a / g) || !verify(b / g)) break;
    if (i != n - 1) {
      a = b;
      scanf("%d", &b);
    }
  }
  puts(i == n ? "Yes" : "No");
  return 0;
}
