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