#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x;
  int b;
  for (int i = 0; i < n; i++) {
    cin >> x;
    while (true) {
      if (x % 2 == 0 || x % 3 == 0) {
        if (x % 2 == 0) {
          x /= 2;
        }
        if (x % 3 == 0) {
          x /= 3;
        }
        continue;
      } else {
        break;
      }
    }
    if (i == 0) {
      b = x;
    }
    if (b != x) {
      cout << "No" << '\n';
      return 0;
    }
  }
  cout << "Yes" << '\n';
}
