#include <bits/stdc++.h>
int main() {
  int A[100001], n, a, b;
  scanf("%i", &n);
  for (int i = 0; i < n; i++) scanf("%i", &A[i]);
  for (int i = 0; i < n; i++) {
    while (A[i] % 2 == 0) A[i] /= 2;
    while (A[i] % 3 == 0) A[i] /= 3;
  }
  for (int i = 0; i < n - 1; i++) {
    if (A[i] != A[i + 1]) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
