#include <bits/stdc++.h>
using namespace std;
bool result(int arr[], int size) {
  bool p = true;
  for (int i = 0; i < size; i++) {
    while ((arr[i] % 2) == 0) {
      arr[i] /= 2;
    }
    while ((arr[i] % 3) == 0) {
      arr[i] /= 3;
    }
  }
  for (int i = 0; i < size - 1; i++) {
    if (arr[i] != arr[i + 1]) {
      p = false;
    }
  }
  return p;
}
int main() {
  int n, a[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (result(a, n))
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
