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