#include <bits/stdc++.h>
using namespace std;
int strip(int x) {
  while ((x & 1) == 0) {
    x = x >> 1;
  }
  while (x % 3 == 0) {
    x /= 3;
  }
  return x;
}
int main() {
  int n, x, d;
  bool ans = true;
  scanf("%d", &n);
  scanf("%d", &d);
  d = strip(d);
  n--;
  while (n--) {
    scanf("%d", &x);
    x = strip(x);
    if (x != d) {
      ans = false;
      break;
    }
  }
  puts(ans ? "Yes" : "No");
}
