#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int reduce(int n) {
  while (n % 2 == 0) n /= 2;
  while (n % 3 == 0) n /= 3;
  return n;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  int r = reduce(arr[0]);
  bool ok = true;
  for (int i = 1; i < n; i++) {
    if (reduce(arr[i]) != r) {
      ok = false;
      break;
    }
  }
  if (ok)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
