#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n];
  set<int> st;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (a[i] && a[i] % 2 == 0) a[i] /= 2;
    while (a[i] && a[i] % 3 == 0) a[i] /= 3;
    st.insert(a[i]);
    if (st.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
