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