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