#include <bits/stdc++.h>
using namespace std;
int get_shared(int x) {
  while ((x % 2) == 0) {
    x /= 2;
  }
  while ((x % 3) == 0) {
    x /= 3;
  }
  return x;
}
int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int shared = get_shared(a[0]);
  for (int i = 1; i < n; i++) {
    if (get_shared(a[i]) != shared) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
