#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
int dp[maxn][maxn][2], mp[maxn][maxn], n, a[maxn];
int solve(int l, int r, int k) {
  if (dp[l][r][k] >= 0) return dp[l][r][k];
  dp[l][r][k] = 0;
  int fa = k ? l - 1 : r;
  if (l >= r) return dp[l][r][k] = 1;
  for (int i = l; i < r; i++) {
    if (mp[i][fa] == 0) continue;
    if (solve(l, i, 0) && solve(i + 1, r, 1)) return dp[l][r][k] = 1;
  }
  return dp[l][r][k];
}
int main() {
  scanf("%d", &n);
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < i; j++) {
      if (gcd(a[i], a[j]) > 1) mp[i][j] = mp[j][i] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (solve(0, i, 0) && solve(i + 1, n, 1)) {
      return puts("Yes"), 0;
    }
  }
  puts("No");
  return 0;
}
