#include <bits/stdc++.h>
using namespace std;
const int MX_SZ = 1e+5 + 5;
int main() {
  map<int, bool> mp;
  int n;
  scanf("%d", &n);
  int a[MX_SZ];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
    }
    while (a[i] % 3 == 0) {
      a[i] /= 3;
    }
    if (i != 0 and !mp[a[i]]) {
      printf("No");
      return 0;
    }
    mp[a[i]] = true;
  }
  printf("Yes");
}
