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