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