#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else if (a > b) {
    return gcd(b, a % b);
  } else {
    return gcd(b, a);
  }
}
int main() {
  long long int gcd1;
  long long int n, mx, arr[100010], k, i;
  memset(arr, 0, sizeof(arr));
  cin >> n;
  mx = 0;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  gcd1 = arr[0];
  for (i = 1; i < n; i++) {
    gcd1 = gcd(gcd1, arr[i]);
    if (gcd1 == 1) {
      break;
    }
  }
  for (i = 0; i < n; i++) {
    arr[i] /= gcd1;
  }
  for (i = 0; i < n; i++) {
    while (arr[i] % 2 == 0) {
      arr[i] /= 2;
    }
    while (arr[i] % 3 == 0) {
      arr[i] /= 3;
    }
    if (arr[i] == 1) {
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
