#include <bits/stdc++.h>
int q[100005];
int gcd(int m, int n) {
  while (m != 0 && n != 0) {
    if (m > n)
      m %= n;
    else
      n %= m;
  }
  return m == 0 ? n : m;
}
int main() {
  int n, j, i, l, f = 0;
  int a, b;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &q[i]);
  for (i = 0; i < n - 1; i++) {
    l = gcd(q[i], q[i + 1]);
    a = q[i] / l;
    b = q[i + 1] / l;
    while (a % 2 == 0) a /= 2;
    while (a % 3 == 0) a /= 3;
    while (b % 2 == 0) b /= 2;
    while (b % 3 == 0) b /= 3;
    if (a == b && a == 1)
      continue;
    else {
      f = 1;
      break;
    }
  }
  if (f == 1)
    printf("No\n");
  else
    printf("Yes\n");
}
