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