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