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