#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int ggcd = v[0];
  for (int i = 1; i < n; i++) {
    ggcd = gcd(ggcd, v[i]);
  }
  for (int i = 0; i < n; i++) {
    v[i] = v[i] / ggcd;
    while (v[i] % 2 == 0 || v[i] % 3 == 0) {
      if (v[i] % 2 == 0) v[i] /= 2;
      if (v[i] % 3 == 0) v[i] /= 3;
    }
  }
  bool fl = true;
  for (int i = 0; i < n; i++) {
    if (v[i] != 1) fl = false;
  }
  if (fl)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
