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