#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  long long arr[n + 1], temp[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= n; i++) {
    temp[i] = arr[i];
    temp[0] = temp[i];
    while (true) {
      if (temp[i] % 2 == 0) {
        temp[i] /= 2;
        temp[0] = temp[i];
      } else if (temp[i] % 3 == 0) {
        temp[i] /= 3;
        temp[0] = temp[i];
      } else {
        if (temp[i] == temp[i - 1]) {
          sum += 1;
        } else {
          i = n + 1;
        }
        break;
      }
    }
  }
  if (sum == n) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
