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