#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, ct, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    while ((x % 2) == 0) x = x / 2;
    while ((x % 3) == 0) x = x / 3;
    a.push_back(x);
  }
  ct = 0;
  for (i = 1; i < n; i++)
    if (a[i] == a[0]) ct++;
  if (ct == (n - 1))
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
