#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int flag = 0;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    while (a[i] % 3 == 0) {
      a[i] = a[i] / 3;
    }
    while (a[i] % 2 == 0) {
      a[i] = a[i] / 2;
    }
  }
  for (int i = 1; i < n; i++) {
    if (a[i] == a[0]) {
      flag = 1;
    } else {
      cout << "NO" << endl;
      flag = 0;
      break;
    }
  }
  if (flag == 1) {
    cout << "Yes" << endl;
  }
}
