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