#include <bits/stdc++.h>
using namespace std;
const int N = 750;
int n, a[N], g[N][N];
vector<int> fac[N];
int L[N][N], R[N][N], c[N][N];
vector<int> calc(int first) {
  vector<int> v;
  for (int i = 2; i * i <= first; ++i)
    if (first % i == 0) {
      v.push_back(i);
      while (first % i == 0) first /= i;
    }
  if (first > 1) v.push_back(first);
  return v;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) {
    fac[i] = calc(a[i]);
    a[i] = 1;
    for (int j : fac[i]) a[i] *= j;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      for (int t : fac[i]) {
        if (a[j] % t == 0) c[i][j] = c[j][i] = 1;
      }
    }
  for (int d = 1; d <= n; ++d)
    for (int l = 1, r = l + d - 1; r <= n; ++l, ++r) {
      if (d == 1) {
        L[l][r] = c[l - 1][l];
        R[l][r] = c[l + 1][l];
        continue;
      }
      if (L[l + 1][r]) {
        if (d == n) return puts("Yes"), 0;
        if (l != 1 && !L[l][r]) L[l][r] = c[l - 1][l];
        if (r != n && !R[l][r]) R[l][r] = c[r + 1][l];
      }
      if (R[l][r - 1]) {
        if (d == n) return puts("Yes"), 0;
        if (l != 1 && !L[l][r]) L[l][r] = c[l - 1][r];
        if (r != n && !R[l][r]) R[l][r] = c[r + 1][r];
      }
      for (int k = l + 1; k <= r - 1; ++k) {
        if (R[l][k - 1] && L[k + 1][r]) {
          if (d == n) return puts("Yes"), 0;
          if (l != 1 && !L[l][r]) L[l][r] = c[l - 1][k];
          if (r != n && !R[l][r]) R[l][r] = c[r + 1][k];
        }
      }
    }
  puts("No");
}
