#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int MOD = 1e9;
const int N = 1e6 + 5;
const ll oo = 9e18;
const int M = 2001;
ll a[N];
void solve() {
  int n;
  cin >> n;
  ll cur = -1;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    ll x = a[i];
    while (x % 2 == 0 || x % 3 == 0) {
      if (x % 2 == 0)
        x /= 2;
      else
        x /= 3;
    }
    if (cur == -1)
      cur = x;
    else {
      if (cur != x) {
        cout << "No";
        return;
      }
    }
  }
  cout << "Yes";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
