#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, flag, count = 0;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    flag = 0;
    while (flag == 0) {
      if (a[i] % 3 == 0) {
        a[i] = a[i] / 3;
      } else if (a[i] % 2 == 0) {
        a[i] = a[i] / 2;
      } else {
        flag = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == a[0]) {
      count++;
    }
  }
  if (count == n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
