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