#include <bits/stdc++.h>
using namespace std;
int a[100006];
int gcd(int a, int b) { return (b != 0) ? gcd(b, a % b) : a; }
int main() {
  int n, gc, i, flag = 0;
  scanf("%d", &n);
  scanf("%d", &a[0]);
  gc = a[0];
  for (i = 1; i < n; i++) {
    scanf("%d", &a[i]);
    if (gc > a[i])
      gc = gcd(gc, a[i]);
    else
      gc = gcd(a[i], gc);
  }
  for (i = 0; i < n; i++) {
    a[i] /= gc;
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != 1) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    printf("Yes");
  else
    printf("No");
  return 0;
}
