#include <bits/stdc++.h>
using namespace std;
long long a[200000];
int main() {
  long long n, max1 = -1, i, s;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    s = a[i];
    while (s % 2 == 0) s /= 2;
    while (s % 3 == 0) s /= 3;
    a[i] = s;
  }
  for (i = 1; i <= n; i++)
    if (a[i] != a[1]) {
      cout << "NO";
      return 0;
    }
  cout << "Yes";
}
