#include <bits/stdc++.h>
using namespace std;
int Gcd(int a, int b) {
  if (b == 0) return a;
  return Gcd(b, a % b);
}
int Lcm(int a, int b) { return (a * b) / Gcd(a, b); }
const int MAXN = 750;
int v[MAXN], n;
vector<int> com[MAXN];
int dp[MAXN][MAXN][2];
int mat[MAXN][MAXN];
int dfs(int st, int ed, int type) {
  int &ret = dp[st][ed][type];
  if (ret != -1) return ret;
  if (st > ed) return 1;
  if (st == ed) {
    if (type == 0) {
      return mat[ed][ed + 1];
    }
    if (type == 1) {
      return mat[st][st - 1];
    }
  }
  ret = 0;
  for (int root = st; root <= ed; root++) {
    if (dfs(st, root - 1, 0) && dfs(root + 1, ed, 1)) {
      if (type == 0 && mat[root][ed + 1]) {
        return ret = 1;
      } else if (type == 1 && mat[root][st - 1]) {
        return ret = 1;
      }
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  sort(v + 1, v + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (Gcd(v[i], v[j]) != 1) {
        mat[i][j] = 1;
        mat[j][i] = 1;
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    dp[i][i - 1][0] = 1;
    dp[i][i - 1][1] = 1;
    dp[i + 1][i][0] = 1;
    dp[i + 1][i][1] = 1;
  }
  for (int root = 1; root <= n; root++) {
    if (dfs(1, root - 1, 0) && dfs(root + 1, n, 1)) {
      cout << "Yes";
      exit(0);
    }
  }
  cout << "No";
  return 0;
}
