#include <bits/stdc++.h>
using namespace std;
long long N, a, b, num, res;
long long curr;
vector<long long> asdf;
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &num);
    asdf.push_back(num);
  }
  for (int i = 0; i < asdf.size(); i++) {
    while (asdf[i] % 2 == 0) asdf[i] /= 2;
    while (asdf[i] % 3 == 0) asdf[i] /= 3;
    res = asdf[0];
    if (asdf[i] != res) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
