#include <bits/stdc++.h>
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  a = a % b;
  return gcd(b, a);
}
int main() {
  long int n;
  int i;
  scanf("%ld", &n);
  long long int arr[n];
  for (i = 0; i < n; i++) scanf("%lld", &arr[i]);
  long long int k = arr[0];
  for (i = 1; i < n; i++) k = gcd(k, arr[i]);
  long long int e;
  for (i = 0; i < n; i++) {
    e = arr[i] / k;
    while (e % 3 == 0) e = e / 3;
    while (e % 2 == 0) e = e / 2;
    if (e > 1) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
