#include <bits/stdc++.h>
using namespace std;
int bids[100006];
bool checkEqual(int n) {
  for (int i = 1; i < n; i++) {
    if (bids[i] != bids[0]) return false;
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", bids + i);
  for (int i = 0; i < n; i++) {
    while (bids[i] % 2 == 0) bids[i] /= 2;
    while (bids[i] % 3 == 0) bids[i] /= 3;
  }
  if (checkEqual(n))
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
