#include <bits/stdc++.h>
using namespace std;
inline string get_string() {
  char ch[1000000];
  scanf("%s", ch);
  return ch;
}
map<int, vector<pair<int, int>>> graph;
vector<pair<int, pair<int, int>>> edges;
int main() {
  int n;
  scanf("%d", &n);
  int list[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &list[i]);
    while (list[i] % 6 == 0) list[i] /= 6;
    while (list[i] % 3 == 0) list[i] /= 3;
    while (list[i] % 2 == 0) list[i] /= 2;
    if (i && list[i] != list[i - 1]) {
      cout << "No"
           << "\n";
      exit(0);
    }
  }
  cout << "Yes"
       << "\n";
}
