#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mx = -1;
bool f(ll k) {
  if (k > mx) {
    return false;
  }
  if (k == mx) return true;
  return (f(2 * k) || f(3 * k));
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int v, t;
  cin >> v;
  while (v % 2 == 0) v /= 2;
  while (v % 3 == 0) v /= 3;
  for (auto i = 0; i < n - 1; i++) {
    cin >> t;
    while (t % 2 == 0) t /= 2;
    while (t % 3 == 0) t /= 3;
    if (t != v) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
