#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return (y == 0) ? x : gcd(y, x % y); }
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  int m = *(max_element(v.begin(), v.end()));
  for (int i = 0; i < n; i++) {
    if (v[i] == m) continue;
    long long g1 = gcd(m, v[i]);
    long long g =
        (long long)(((long long)(((long long)m) * ((long long)v[i]))) /
                    (((long long)g1) * ((long long)g1)));
    while (g != 1 && (g % 2 == 0 || g % 3 == 0)) {
      if (g % 2 == 0)
        g /= 2;
      else if (g % 3 == 0)
        g /= 3;
      else
        break;
    }
    if (g != 1) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
