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