#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e18 + 7;
const int N = 1e5 + 50000;
const int K = 2e4 + 20;
const int OPEN = 100;
const int CLOSE = 99;
const int mod = 1e9 + 7;
void boost() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void file() {
  freopen("INPUT.TXT", "r", stdin);
  freopen("OUTPUT.TXT", "w", stdout);
}
int n, a[N];
int main() {
  boost();
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i < n; ++i) {
    if (a[i] != a[i + 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
