#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int main() {
  ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  long long x, n, a;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    while (!(x % 2)) x /= 2;
    while (!(x % 3)) x /= 3;
    if (i == 1)
      a = x;
    else if (a != x)
      return cout << "No"
                  << "\n",
             0;
  }
  return cout << "Yes"
              << "\n",
         0;
  return 0;
}
