#include <bits/stdc++.h>
int main() {
  int n, x, X = -1;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    while (x % 2 == 0) x /= 2;
    while (x % 3 == 0) x /= 3;
    if (i != 0 && x != X) {
      printf("No", x, X);
      return 0;
    }
    X = x;
  }
  puts("Yes");
  return 0;
}
