#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100000];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    while (!(x & 1)) x >>= 1;
    while (x % 3 == 0) x /= 3;
    a[i] = x;
  }
  int y = 1;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] != a[i]) {
      y = 0;
      break;
    }
  }
  if (y)
    cout << "Yes";
  else
    cout << "No";
}
