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