#include <bits/stdc++.h>
int main() {
  int n, i, x, prev;
  bool win;
  scanf("%d", &n);
  win = true;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    while (x % 2 == 0) {
      x /= 2;
    }
    while (x % 3 == 0) {
      x /= 3;
    }
    if (i == 0)
      prev = x;
    else if (x != prev)
      win = false;
  }
  if (win)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
