#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int nn, n;
  cin >> nn;
  vector<long long int> v;
  for (int i = 0; i < nn; i++) {
    cin >> n;
    while (n % 3 == 0) n = n / 3;
    while (n % 2 == 0) n = n / 2;
    v.push_back(n);
  }
  if (*max_element(v.begin(), v.end()) == *min_element(v.begin(), v.end()))
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
