#include <bits/stdc++.h>
using namespace std;
int N;
long long arr[100005];
long long adiasma[100005];
long long adiase(long long x) {
  while (x % 2 == 0) x = x / 2;
  while (x % 3 == 0) x = x / 3;
  return x;
}
int check() {
  for (int i = 1; i < N; i++)
    if (adiasma[i] != adiasma[i - 1]) return 0;
  return 1;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
    adiasma[i] = adiase(arr[i]);
  }
  if (check() == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
