#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
int main() {
  long long n;
  cin >> n;
  long long ans = -1;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    while (x % 2 == 0) x /= 2;
    while (x % 3 == 0) x /= 3;
    if (ans == -1)
      ans = x;
    else if (ans != x) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
