#include <bits/stdc++.h>
std::string bearandpoker_eval(std::vector<uint64_t>& bids);
void bearandpoker_print(std::ostream& w, const std::string& answer);
void bearandpoker_solve(std::istream& r, std::ostream& w);
std::string bearandpoker_eval(std::vector<uint64_t>& bids) {
  for (int i = 0; i < bids.size(); ++i) {
    bool finished = false;
    while (!finished) {
      if ((bids[i] % 2) == 0) {
        bids[i] = bids[i] / 2;
      } else if ((bids[i] % 3) == 0) {
        bids[i] = bids[i] / 3;
      } else {
        finished = true;
      }
    }
    if (bids[i] != bids[0]) {
      return "No";
    }
  }
  return "Yes";
}
void bearandpoker_print(std::ostream& w, const std::string& answer) {
  w << answer << std::endl;
}
void bearandpoker_solve(std::istream& r, std::ostream& w) {
  std::string s;
  int num_bears = 0;
  if (std::getline(r, s)) {
    std::istringstream sin(s);
    sin >> num_bears;
  }
  std::vector<uint64_t> bids;
  if (std::getline(r, s)) {
    std::istringstream sin(s);
    for (int i = 0; i < num_bears; ++i) {
      int bid = 0;
      sin >> bid;
      bids.emplace_back(bid);
    }
  }
  std::string answer = bearandpoker_eval(bids);
  bearandpoker_print(w, answer);
}
int main() {
  using namespace std;
  bearandpoker_solve(cin, cout);
  return 0;
}
