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