#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> v1;
  for (int i = 0; i <= n - 1; ++i) {
    int a;
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
    }
    while (a % 3 == 0) {
      a /= 3;
    }
    v1.push_back(a);
  }
  for (int i = 0; i <= n - 1; ++i) {
    if (v1[i] != v1[0]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
