#include <bits/stdc++.h>
using namespace std;
const int maxn = 705;
int n, a[maxn];
int dp[2][maxn][maxn];
bool good[maxn][maxn];
bool dfs(bool left, int l, int r) {
  int par;
  if (left)
    par = r + 1;
  else
    par = l - 1;
  if (l == 0 && r == n - 1) par = 701;
  if (l == r) return good[l][par];
  if (dp[left][l][r] != -1) return dp[left][l][r];
  int ret = 0;
  if (par == 701 || good[par][l]) ret |= dfs(false, l + 1, r);
  if (par == 701 || good[par][r]) ret |= dfs(true, l, r - 1);
  for (int i = l + 1; i < r; i++) {
    if (par == 701 || good[par][i])
      ret |= (dfs(true, l, i - 1) & dfs(false, i + 1, r));
    if (ret) return dp[left][l][r] = ret;
  }
  return (dp[left][l][r] = ret);
}
int gcd(int x, int y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < n; j++) {
      if (gcd(a[i], a[j]) > 1) {
        good[i][j] = true;
        good[j][i] = true;
      }
    }
  }
  if (dfs(701, 0, n - 1))
    cout << "Yes" << '\n';
  else
    cout << "No" << '\n';
}
