#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[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 flag = 1;
  int val = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] != val) flag = 0;
  }
  if (flag)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
