#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int a[100100];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  int temp = 0;
  for (int i = 0; i < n; ++i) temp = gcd(temp, a[i]);
  bool flag = true;
  for (int i = 0; i < n; ++i) {
    a[i] /= temp;
    while (a[i] % 3 == 0) a[i] /= 3;
    if ((a[i] & -a[i]) != a[i]) flag = false;
  }
  if (flag)
    puts("Yes");
  else
    puts("No");
  return 0;
}
