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