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