#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long c = 0;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
int main() {
  int n;
  bool flag = true;
  long long prev, cur;
  scanf("%d", &n);
  scanf("%I64d", &prev);
  for (int i = 1; i < n; i++) {
    scanf("%I64d", &cur);
    long long value = gcd(cur, prev);
    int cnt = 0;
    long long res1 = prev / value;
    while (res1 > 1) {
      if (res1 % 3 == 0)
        res1 = res1 / 3;
      else if (res1 % 2 == 0)
        res1 = res1 / 2;
      else
        break;
    }
    long long res2 = cur / value;
    while (res2 > 1) {
      if (res2 % 3 == 0)
        res2 = res2 / 3;
      else if (res2 % 2 == 0)
        res2 = res2 / 2;
      else
        break;
    }
    if ((res1 != 1) || (res2 != 1)) {
      flag = false;
    }
    prev = cur;
  }
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
