#include <bits/stdc++.h>
using namespace std;
bool func23(long long *arr, long long n) {
  set<long long> s;
  for (long long i = 1; i <= n; i++) {
    s.insert(arr[i]);
  }
  if (s.size() == 1) return 1;
  return 0;
}
void func12(long long *arr, long long n) {
  for (long long i = 1; i <= n; i++) {
    while (arr[i] > 1 && arr[i] % 2 == 0) {
      arr[i] = arr[i] >> 1;
    }
    while (arr[i] > 1 && arr[i] % 3 == 0) {
      arr[i] = arr[i] / 3;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  func12(arr, n);
  if (func23(arr, n))
    cout << "Yes\n";
  else
    cout << "No\n";
}
