#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long int a[100005], n;
int main() {
  long long int maxa = INT_MIN, ans = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    maxa = max(maxa, a[i]);
  }
  while (maxa % 2 == 0) maxa /= 2;
  while (maxa % 3 == 0) maxa /= 3;
  for (int i = 0; i < n; i++) {
    long long int num = a[i];
    while (num % 2 == 0) num /= 2;
    while (num % 3 == 0) num /= 3;
    if (num != maxa) {
      ans = 1;
      break;
    }
  }
  if (ans == 1)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
