#include <bits/stdc++.h>
using namespace std;
bool solve() {
  int n;
  bool ret = false;
  int m = 0;
  scanf("%d", &n);
  int a;
  scanf("%d", &a);
  while ((a & 1) == 0) a >>= 1;
  while (a % 3 == 0) a /= 3;
  m = a;
  for (int i = 1; i < n; i++) {
    int a;
    scanf("%d", &a);
    while ((a & 1) == 0) a >>= 1;
    while (a % 3 == 0) a /= 3;
    if (m != a) return false;
  }
  return true;
}
int main() {
  if (solve())
    puts("Yes");
  else
    puts("No");
  return 0;
}
