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