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