#include <bits/stdc++.h>
using namespace std;
int const N = 500 * 1000 + 16;
int n;
int main() {
  cin >> n;
  set<int> s;
  while (s.size() < 2 && n--) {
    int x;
    cin >> x;
    while ((x & 1) == 0) x >>= 1;
    while ((x % 3) == 0) x /= 3;
    s.insert(x);
  }
  cout << vector<string>{"Yes", "No"}[s.size() > 1];
}
