#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  set<int> s;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> m;
    while (m % 2 == 0) m /= 2;
    while (m % 3 == 0) m /= 3;
    s.insert(m);
  }
  if (s.size() == 1)
    cout << "Yes";
  else
    cout << "No";
}
