#include <bits/stdc++.h>
using namespace std;
vector<int> v;
bool prime[1000001];
void sieve() {
  prime[2] = true;
  for (int i = 4; i <= 1000000; i += 2) {
    prime[i] = false;
    prime[i - 1] = true;
  }
  for (int i = 3; i <= 1000; i += 2) {
    if (prime[i]) {
      for (int j = i * i; j <= 1000000; j += 2 * i) {
        prime[j] = false;
      }
    }
  }
}
void pf(int x, int m) {
  for (int i = 2; i <= 3; i++) {
    if (x % i == 0) {
      while (x % i == 0) {
        x /= i;
      }
    }
  }
  v.push_back(x);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    pf(x, i);
    if (v[i] != v[i - 1] && i > 0) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
