#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, x, y, b, i, j, k, l, n, m, a[200005];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    while (j % 2 == 0) j /= 2;
    while (j % 3 == 0) j /= 3;
    a[i] = j;
  }
  for (i = 0; i < n - 1; i++)
    if (a[i] != a[i + 1]) {
      cout << "No\n";
      return 0;
    }
  cout << "Yes\n";
  return 0;
}
