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