#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, val;
  set<int> S;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> val;
    while (val % 2 == 0) val >>= 1;
    while (val % 3 == 0) val /= 3;
    S.insert(val);
  }
  if (S.size() > 1)
    cout << "No\n";
  else
    cout << "Yes\n";
  return 0;
}
