#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  set<int> a;
  while (n--) {
    int k;
    scanf("%d", &k);
    while (k % 2 == 0) k /= 2;
    while (k % 3 == 0) k /= 3;
    a.insert(k);
  }
  if (a.size() == 1)
    puts("Yes");
  else
    puts("No");
  return 0;
}
