#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t, f;
  scanf("%d", &n);
  vector<int> a;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    a.push_back(t);
  }
  for (int i = 0; i < n; i++) {
    while (!(a[i] % 2)) a[i] /= 2;
    while (!(a[i] % 3)) a[i] /= 3;
  }
  bool x = 1;
  for (int i = 0; i < n - 1; i++)
    if (a[i] != a[i + 1]) {
      x = 0;
      break;
    }
  cout << (x ? "Yes\n" : "No\n");
  return 0;
}
