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