#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      while (a[i] % 2 == 0) a[i] /= 2;
      while (a[i] % 3 == 0) a[i] /= 3;
    }
    int flag = 0;
    for (int i = 1; i < n; i++) {
      if (a[i] != a[i - 1]) {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
}
