#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> arr;
bool solve() {
  int bs;
  bs = arr[0];
  while ((bs % 2) == 0) bs /= 2;
  while ((bs % 3) == 0) bs /= 3;
  for (int i = 1; i < arr.size(); i++) {
    while ((arr[i] % 2) == 0) arr[i] /= 2;
    while ((arr[i] % 3) == 0) arr[i] /= 3;
    if (arr[i] != bs) return false;
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    scanf("%d", &temp);
    arr.push_back(temp);
  }
  if (solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
