#include <bits/stdc++.h>
using namespace std;
int A[100009];
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n, GCD;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  GCD = A[0];
  for (int i = 1; i < n; i++) GCD = gcd(GCD, A[i]);
  int flag = 0;
  for (int i = 0; i < n; i++) {
    int x = A[i] / GCD, n1;
    n1 = x;
    while (n1 > 1) {
      if (n1 % 2 != 0 && n1 % 3 != 0) {
        if (n1 != 1) flag = 1;
        break;
      } else {
        while (n1 % 2 == 0) n1 /= 2;
        while (n1 % 3 == 0) n1 /= 3;
      }
    }
    if (flag) break;
  }
  if (flag)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
