#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  while (a[0] % 2 == 0) a[0] /= 2;
  while (a[0] % 3 == 0) a[0] /= 3;
  bool f = 1;
  for (long long i = 1; i < n; i++) {
    if (a[i] % a[0] != 0) {
      f = 0;
      break;
    }
    a[i] /= a[0];
  }
  for (long long i = 1; i < n; i++) {
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
    if (a[i] != 1) f = 0;
  }
  if (f)
    cout << "Yes";
  else
    cout << "No";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
