#include <bits/stdc++.h>
using namespace std;
const int MAXN = 705;
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
int n, a[MAXN];
bool g[MAXN][MAXN], L[MAXN][MAXN], R[MAXN][MAXN];
int main() {
  scanf("%d", &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) {
      g[i][j] = g[j][i] = gcd(a[i], a[j]) > 1;
    }
  }
  for (int i = 1; i <= n + 1; ++i) {
    L[i][i - 1] = R[i][i - 1] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    L[i][i] = R[i - 1][i - 1] = g[i - 1][i];
  }
  for (int l = 2; l <= n; ++l) {
    for (int i = 1; i + l - 1 <= n; ++i) {
      int j = i + l - 1;
      for (int k = i; k <= j; ++k) {
        L[i][j] |= g[i - 1][k] && R[i][k - 1] && L[k + 1][j];
        R[i][j] |= g[k][j + 1] && R[i][k - 1] && L[k + 1][j];
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (R[1][i - 1] && L[i + 1][n]) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}
