#include <bits/stdc++.h>
using namespace std;
int n, arr[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", arr + i);
    while (arr[i] % 2 == 0) arr[i] >>= 1;
    while (arr[i] % 3 == 0) arr[i] /= 3;
  }
  for (int i = 1; i < n; ++i) {
    if (arr[i] != arr[i - 1]) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}
