#include <bits/stdc++.h>
using namespace std;
long long Off2(long long A, long long p) {
  while (A % p == 0) A /= p;
  return A;
}
int main() {
  int n;
  cin >> n;
  long long Now, Ai;
  cin >> Now;
  Now = Off2(Now, 2);
  Now = Off2(Now, 3);
  bool Jug = true;
  for (int i = 1; i < n; ++i) {
    cin >> Ai;
    long long tmp = Off2(Ai, 2);
    tmp = Off2(tmp, 3);
    if (tmp != Now) {
      Jug = false;
      break;
    }
  }
  if (Jug)
    puts("Yes");
  else
    puts("No");
}
