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