#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
void solve() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < (int)(n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(n); ++i)
    while (a[i] % 2 == 0) a[i] /= 2;
  for (int i = 0; i < (int)(n); ++i)
    while (a[i] % 3 == 0) a[i] /= 3;
  for (int i = 0; i < (int)(n); ++i)
    if (a[i] != a[0]) {
      puts("No");
      return;
    }
  puts("Yes");
}
void testgen() {
  FILE* f = fopen("input.txt", "w");
  fclose(f);
}
int main() {
  cout << fixed;
  cout.precision(16);
  cerr << fixed;
  cerr.precision(3);
  solve();
  return 0;
}
