#include <bits/stdc++.h>
using namespace std;
bool compare(int a, int b) { return a > b; }
class Compare {
 public:
  bool operator()(int a, int b) { return a > b; }
};
int mod(int a, int b) { return ((a % b) + b) % b; }
int get_rem_2_3(int num) {
  while (!(num % 2)) num /= 2;
  while (!(num % 3)) num /= 3;
  return num;
}
int num, n, rem;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    if (i != 0) {
      if (get_rem_2_3(num) != rem) {
        printf("No\n");
        return 0;
      }
    } else
      rem = get_rem_2_3(num);
  }
  printf("Yes\n");
  return 0;
}
