#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n, k, i, c = 0, j = 0;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n; i++) {
    while (arr[i] % 2 == 0) {
      arr[i] /= 2;
    }
    while (arr[i] % 3 == 0) {
      arr[i] /= 3;
    }
  }
  for (int i = 1; i < n; i++) {
    if (arr[i] != arr[i - 1]) c++;
  }
  if (c)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
