#include <bits/stdc++.h>
using namespace std;
vector<long long int> prime;
vector<pair<long long int, long long int>> ans[100000];
void func() {
  bool arr[32000];
  for (long long int i = 0; i < 32000; i++) arr[i] = 0;
  for (long long int i = 2; i * i < 32000; i++) {
    if (arr[i] == 0) {
      long long int t = i;
      while (i * t < 32000) {
        arr[i * t] = 1;
        t++;
      }
    }
  }
  for (long long int i = 4; i < 32000; i++) {
    if (arr[i] == 0) prime.push_back(i);
  }
}
void func1() {
  vector<pair<long long int, long long int>> v;
  v.clear();
  ans[1] = ans[2] = ans[3] = v;
  for (long long int i = 4; i < 100000; i++) {
    long long int temp = i;
    while (temp % 2 == 0) temp /= 2;
    while (temp % 3 == 0) temp /= 3;
    vector<pair<long long int, long long int>> v;
    v.clear();
    if (temp == 1) {
      ans[i] = v;
      continue;
    } else {
      for (long long int j = 0; j < prime.size(); j++) {
        long long int x = prime[j];
        if (temp % x == 0) {
          long long int count = 0;
          while (temp % x == 0) {
            count++;
            temp /= x;
          }
          v.push_back(make_pair(x, count));
        }
        if (temp == 1) break;
      }
      if (temp != 1) v.push_back(make_pair(temp, 1));
      ans[i] = v;
    }
  }
}
vector<pair<long long int, long long int>> factors(long long int temp) {
  while (temp % 2 == 0) temp /= 2;
  while (temp % 3 == 0) temp /= 3;
  if (temp < 100000) return ans[temp];
  vector<pair<long long int, long long int>> v;
  v.clear();
  for (long long int i = 0; i < prime.size(); i++) {
    long long int x = prime[i];
    if (temp % x == 0) {
      long long int count = 0;
      while (temp % x == 0) {
        count++;
        temp /= x;
      }
      v.push_back(make_pair(x, count));
    }
    if (temp == 1) break;
  }
  if (temp != 1) v.push_back(make_pair(temp, 1));
  return v;
}
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  func();
  func1();
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  vector<pair<long long int, long long int>> v1 = factors(arr[n - 1]);
  set<long long int> s;
  s.clear();
  s.insert(arr[n - 1]);
  for (long long int i = 0; i < n - 1; i++) {
    long long int temp = arr[i];
    if (s.find(temp) == s.end()) {
      vector<pair<long long int, long long int>> v = factors(temp);
      s.insert(temp);
      if (v != v1) {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}
