#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int ar[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &ar[i]);
  for (int i = 0; i < n; i++) {
    while (ar[i] % 2 == 0) ar[i] /= 2;
    while (ar[i] % 3 == 0) ar[i] /= 3;
  }
  for (int i = 0; i < n; i++) {
    if (ar[i] == 1) continue;
    int tp = ar[i];
    for (int j = 0; j < n; j++) {
      if (ar[j] % tp) {
        puts("No");
        return 0;
      } else
        ar[j] /= tp;
    }
  }
  puts("Yes");
  return 0;
}
