#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
    }
    while (a[i] % 3 == 0) {
      a[i] /= 3;
    }
  }
  long long tt = a[0];
  bool ans = true;
  for (int i = 1; i < n; i++) {
    if (a[i] != tt) {
      ans = false;
      break;
    }
  }
  if (ans) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
