#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
const int Mod = 1000000007;
const int Max = 200003;
int N, m;
int main() {
  cin >> N;
  bool b = true;
  int a[Max];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    while (a[i] % 2 == 0 || a[i] % 3 == 0) {
      if (a[i] % 2 == 0) a[i] /= 2;
      if (a[i] % 3 == 0) a[i] /= 3;
    }
    if (a[i] != a[0]) {
      b = false;
      break;
    }
  }
  if (b)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
