#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, ans, a;
  cin >> n >> ans;
  while (ans % 2 == 0) ans /= 2;
  while (ans % 3 == 0) ans /= 3;
  while (--n) {
    scanf("%d", &a);
    while (a % 2 == 0) a /= 2;
    while (a % 3 == 0) a /= 3;
    if (a != ans) {
      cout << "No" << endl;
      break;
    }
  }
  if (n == 0) cout << "Yes" << endl;
  return 0;
}
