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