#include <bits/stdc++.h>
using namespace std;
const int NMAX = 100010;
int N, A[NMAX];
int main() {
  scanf("%i", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%i", &A[i]);
    while (A[i] % 2 == 0) A[i] /= 2;
    while (A[i] % 3 == 0) A[i] /= 3;
  }
  bool Bad = 0;
  for (int i = 2; i <= N; ++i)
    if (A[i] != A[i - 1]) Bad = 1;
  if (Bad)
    printf("No\n");
  else
    printf("Yes\n");
}
