#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
  int x;
  cin >> x;
  vector<int> v(x);
  for (int i = 0; i < x; i++) {
    scanf("%d", &v[i]);
    while (v[i] % 3 == 0) v[i] /= 3;
    while (v[i] % 2 == 0) v[i] /= 2;
  }
  for (int i = 0; i < x - 1; i++)
    if (v[i] != v[i + 1]) {
      cout << "No";
      return 0;
    }
  cout << "Yes";
  return 0;
}
