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