#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (a[i] > 0 && a[i] % 2 == 0) {
      a[i] /= 2;
    }
    while (a[i] > 0 && a[i] % 3 == 0) {
      a[i] /= 3;
    }
  }
  sort(a, a + n);
  if (a[0] == a[n - 1])
    puts("Yes");
  else
    puts("No");
  return 0;
}
