#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n;
  cin >> n;
  int prev = -1;
  int cur;
  for (int i = 0; i < n; ++i) {
    cin >> cur;
    while (cur % 2 == 0 || cur % 3 == 0) {
      if (cur % 12 == 0) {
        cur /= 12;
      }
      if (cur % 6 == 0) {
        cur /= 6;
      }
      if (cur % 2 == 0) {
        cur /= 2;
      }
      if (cur % 3 == 0) {
        cur /= 3;
      }
    }
    if (i != 0) {
      if (cur != prev) {
        cout << "No";
        return 0;
      }
    } else {
      prev = cur;
    }
  }
  cout << "Yes";
  return 0;
}
