#include <bits/stdc++.h>
using namespace std;
const long long int N = (1e6);
const long long int mod = (1e9 + 7);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    while (1) {
      if (arr[i] % 2 == 0)
        arr[i] /= 2;
      else
        break;
    }
    while (1) {
      if (arr[i] % 3 == 0)
        arr[i] /= 3;
      else
        break;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (arr[i] != arr[0]) return cout << "No", 0;
  }
  cout << "Yes", 0;
}
