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