#include <bits/stdc++.h>
using namespace std;
int main() {
  int number_of_players;
  cin >> number_of_players;
  int old_bid, counter;
  for (counter = 0; counter < number_of_players; counter++) {
    int bid;
    cin >> bid;
    while (bid % 2 == 0) bid /= 2;
    while (bid % 3 == 0) bid /= 3;
    if (counter == 0)
      old_bid = bid;
    else if (old_bid != bid) {
      cout << "No" << endl;
      break;
    }
  }
  if (counter == number_of_players) cout << "Yes" << endl;
  return 0;
}
