#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int pre = 0;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    while (x % 3 == 0) x /= 3;
    while (x % 2 == 0) x /= 2;
    if (i == 0)
      pre = x;
    else if (x != pre) {
      printf("No\n");
      flag = false;
      break;
    }
  }
  if (flag) printf("Yes\n");
  return 0;
}
