#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmax(T &x, T y) {
  if (x < y) x = y;
}
template <class T>
inline void chkmin(T &x, T y) {
  if (x > y) x = y;
}
int n, a[100100];
bool fl;
void func(int i) {
  scanf("%d", &a[i]);
  while (!(a[i] % 2)) a[i] /= 2;
  while (!(a[i] % 3)) a[i] /= 3;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) func(i);
  for (int i = 0; i < n; i++)
    if (a[i] != a[0]) fl = 1;
  if (fl)
    puts("No");
  else
    puts("Yes");
  return 0;
}
