#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
int a[111114];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    while (a[i] % 2 == 0) a[i] /= 2;
    while (a[i] % 3 == 0) a[i] /= 3;
  }
  sort(a + 1, a + n + 1);
  if (a[1] == a[n])
    puts("Yes");
  else
    puts("No");
  return 0;
}
