#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   long long ara[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long n;     cin >> n;     long long mx = 0;     for (long long i = 0; i < n; ++i) {       cin >> ara[i];       while (ara[i] % 2 == 0) ara[i] /= 2;       while (ara[i] % 3 == 0) ara[i] /= 3;     }     for (long long i = 1; i < n; ++i) {       if (ara[i] != ara[0]) return cout <<  No , 0;     }     cout <<  Yes ;   }   