#include <bits/stdc++.h>
using namespace std;
int lcm(int m, int n) {
  int a, b;
  a = m;
  b = n;
  while (a != b) {
    if (a < b)
      a = a + m;
    else
      b = b + n;
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  int *arr = new int[n];
  int *arr1 = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    while (arr[i] % 2 == 0) {
      arr[i] = arr[i] / 2;
    }
    while (arr[i] % 3 == 0) {
      arr[i] = arr[i] / 3;
    }
  }
  for (int i = 1; i < n; i++) {
    if (arr[i] != arr[i - 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
