#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
bool plaus = true;
int nums;
int nList[MAXN + 5];
int main() {
  scanf("%d", &nums);
  for (int i = 1; i <= nums; i++) {
    scanf("%d", &nList[i]);
    while (nList[i] % 2 == 0) nList[i] /= 2;
    while (nList[i] % 3 == 0) nList[i] /= 3;
  }
  for (int i = 1; i < nums; i++)
    if (nList[i] != nList[i + 1]) plaus = false;
  if (plaus)
    printf("Yes\n");
  else
    printf("No\n");
}
