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