#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 20;
long long a[maxx];
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int r;
  while (a[0] % 2 == 0) a[0] /= 2;
  while (a[0] % 3 == 0) a[0] /= 3;
  r = a[0];
  for (i = 1; i < n; i++) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != r) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
