#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
bool b[maxn][maxn];
int a[maxn], dp[maxn][maxn][2], vis[maxn][maxn];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void dfs(int l, int r) {
  if (vis[l][r]) return;
  vis[l][r] = 1;
  if (l > r) dp[l][r][0] = dp[l][r][1] = 1;
  if (l == r) dp[l][r][0] += b[l - 1][l], dp[l][r][1] += b[r + 1][l];
  for (int i = l; i <= r; i++) {
    dfs(l, i - 1);
    dfs(i + 1, r);
    if (dp[l][i - 1][1] && dp[i + 1][r][0])
      dp[l][r][0] += b[l - 1][i], dp[l][r][1] += b[r + 1][i];
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) b[i][j] = gcd(a[i], a[j]) > 1;
  for (int i = 1; i <= n; i++) {
    dfs(1, i - 1);
    dfs(i + 1, n);
    if (dp[1][i - 1][1] && dp[i + 1][n][0]) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
