#include <bits/stdc++.h>
int main() {
  long long int i, n, j, temp, bid;
  scanf("%I64d", &n);
  for (i = 0; i < n; i++) {
    scanf("%I64d", &bid);
    while (bid % 2 == 0) bid = bid / 2;
    while (bid % 3 == 0) bid = bid / 3;
    if (i == 0) temp = bid;
    if (temp != bid) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
