#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool flag = true;
  int tmp, last = 0;
  for (int x = 0; x < n; x++) {
    cin >> tmp;
    while (tmp % 2 == 0) tmp /= 2;
    while (tmp % 3 == 0) tmp /= 3;
    if (last == 0) last = tmp;
    if (tmp != last) flag = false;
  }
  cout << (flag ? "Yes" : "No") << endl;
}
