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