#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, a;
  cin >> n;
  set<int> st;
  while (n--) {
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
    }
    while (a % 3 == 0) {
      a /= 3;
    }
    st.insert(a);
  }
  n = st.size();
  cout << (n == 1 ? "Yes" : "No");
  return 0;
}
