#include <bits/stdc++.h>
using namespace std;
int a[100505];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; i++) {
      while (a[i] % 2 == 0) a[i] /= 2;
      while (a[i] % 3 == 0) a[i] /= 3;
    }
    int flag = 0;
    sort(a + 1, a + 1 + n);
    for (int i = 2; i <= n; i++) {
      if (a[i] != a[i - 1]) flag = 1;
    }
    if (flag == 0)
      printf("Yes\n");
    else
      printf("No\n");
  }
}
