#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
  }
  bool f = 1;
  for (int i = 0; i < n; ++i) {
    if (a[i] != a[0]) {
      f = 0;
      break;
    }
  }
  if (f)
    cout << "Yes" << '\n';
  else
    cout << "No" << '\n';
  return 0;
}
