#include <bits/stdc++.h>
using namespace std;
int n, p[100005];
bool ans;
bool Solution() {
  int tmp = 0;
  for (int i = 0; i < n; ++i) {
    tmp = p[i];
    while (tmp % 3 == 0) {
      tmp /= 3;
    }
    while (tmp % 2 == 0) {
      tmp /= 2;
    }
    p[i] = tmp;
  }
  for (int i = 1; i < n; ++i) {
    if (p[i] != p[i - 1]) return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
  }
  ans = Solution();
  if (ans)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
