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