#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graf;
vector<long long> used;
int main() {
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    while (temp % 3 == 0) temp /= 3;
    while (temp % 2 == 0) temp /= 2;
    used.push_back(temp);
  }
  for (int i = 1; i < n; i++)
    if (used[i - 1] != used[i]) {
      cout << "No";
      return 0;
    }
  cout << "Yes";
  return 0;
}
