#include <bits/stdc++.h>
using namespace std;
int sum[702], n, dp[702][702][2], t[702][702], ans;
int dfs(int l, int r, int x) {
  if (l > r) return 1;
  if (dp[l][r][x] == 1) return 1;
  if (dp[l][r][x] == -1) return 0;
  int res = 0, fa = (x == 0 ? l - 1 : r + 1);
  if (l == r) return t[fa][l];
  for (int i = l; i <= r; ++i)
    if (t[fa][i]) res |= dfs(l, i - 1, 1) & dfs(i + 1, r, 0);
  if (res == 0)
    dp[l][r][x] = -1;
  else
    dp[l][r][x] = 1;
  return res;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main(void) {
  register int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", &sum[i]);
  for (i = 1; i <= n; ++i)
    for (j = i + 1; j <= n; ++j)
      if (gcd(sum[i], sum[j]) > 1) t[i][j] = t[j][i] = 1;
  for (i = 1; i <= n; ++i) ans |= dfs(1, i - 1, 1) & dfs(i + 1, n, 0);
  if (ans)
    puts("Yes");
  else
    puts("No");
  return 0;
}
