#include <bits/stdc++.h>
std::string bearandpoker_eval(const std::vector<uint32_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(const std::vector<uint32_t>& bids) {
  uint32_t common = 0;
  for (int i = 0; i < bids.size(); ++i) {
    uint32_t bid = bids[i];
    bool finished = false;
    while (!finished) {
      if ((bid & 1) == 0) {
        bid = bid / 2;
      } else if ((bid % 3) == 0) {
        bid = bid / 3;
      } else {
        finished = true;
      }
    }
    if (i == 0) {
      common = bid;
    } else if (bid != common) {
      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<uint32_t> bids(num_bears);
  if (std::getline(r, s)) {
    std::istringstream sin(s);
    for (int i = 0; i < num_bears; ++i) {
      int bid = 0;
      sin >> bid;
      bids[i] = bid;
    }
  }
  std::string answer = bearandpoker_eval(bids);
  bearandpoker_print(w, answer);
}
int main() {
  using namespace std;
  bearandpoker_solve(cin, cout);
  return 0;
}
