#include <bits/stdc++.h>
using namespace std;
int a[705];
bool d[705][705];
int dp[705][705][2];
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
bool dfs(int rt, int l, int r, int k) {
  if (l > r) return 1;
  if (dp[l][r][k] != -1) return dp[l][r][k];
  int f = 0;
  for (int i = r; i >= l; i--) {
    if (d[i][rt] && dfs(i, l, i - 1, 0) && dfs(i, i + 1, r, 1)) {
      f = 1;
      break;
    }
  }
  return dp[l][r][k] = f;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (gcd(a[i], a[j]) != 1) {
        d[i][j] = d[j][i] = 1;
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  int f = 1;
  for (int i = n; i >= 1; i--) {
    if (dfs(i, 1, i - 1, 0) && dfs(i, i + 1, n, 1)) {
      f = 0;
      break;
    }
  }
  if (f)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}
