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