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