#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int var = 0;
  for (int i = 0; i < n; i++) {
    while (a[i] % 2 == 0 || a[i] % 3 == 0) {
      if (a[i] % 2 == 0) a[i] /= 2;
      if (a[i] % 3 == 0) a[i] /= 3;
    }
    if (a[i] != var && var != 0) {
      cout << "No\n";
      return 0;
    } else
      var = a[i];
  }
  cout << "Yes\n";
}
