#include <bits/stdc++.h>
using namespace std;
long long dp[100005];
long long judge(long long n) {
  while (n % 2 == 0) n /= 2;
  while (n % 3 == 0) n /= 3;
  return n;
}
int main() {
  long long i, j, k, m, n;
  while (cin >> n) {
    memset(dp, 0, sizeof(dp));
    for (i = 0; i < n; i++) {
      cin >> dp[i];
      dp[i] = judge(dp[i]);
    }
    for (i = 1; i < n; i++) {
      if (dp[i] != dp[i - 1]) break;
    }
    if (i == n)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
