#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
int main() {
  long long int n;
  cin >> n;
  long long int a[n + 1], i, t, x;
  i = 0;
  scanf("%lld", &a[i]);
  t = a[i];
  while (t % 4 == 0) t /= 4;
  while (t % 2 == 0) t /= 2;
  while (t % 9 == 0) t /= 9;
  while (t % 3 == 0) t /= 3;
  x = t;
  long long int flag = 0;
  for (i = 1; i < n; i++) {
    scanf("%lld", &a[i]);
    t = a[i];
    while (t % 4 == 0) t /= 4;
    while (t % 2 == 0) t /= 2;
    while (t % 9 == 0) t /= 9;
    while (t % 3 == 0) t /= 3;
    if (x != t) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
