#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + (s - '0');
    s = getchar();
  }
  return x * f;
}
inline int ABS(int x) { return x < 0 ? -x : x; }
int n, m, i, j, s, o, k;
int a[1005];
inline int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
bool dp[1005][1005][2];
bool f[1005][1005];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read(), dp[i][i][0] = dp[i][i][1] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (gcd(a[i], a[j]) > 1) {
        f[i][j] = f[j][i] = 1;
      }
    }
  }
  for (int jj = 1; jj < n; jj++) {
    for (int i = 1; i + jj <= n; i++) {
      int j = i + jj;
      if (f[i][j]) {
        dp[i][j][0] = dp[i + 1][j][1];
        dp[i][j][1] = dp[i][j - 1][0];
      }
      for (int k = i + 1; k < j; k++) {
        if (f[i][k]) {
          dp[i][j][0] |= (dp[i + 1][k][1] & dp[k][j][0]);
        }
        if (f[k][j]) {
          dp[i][j][1] |= (dp[i][k][1] & dp[k][j - 1][0]);
        }
      }
    }
  }
  bool flag = 0;
  for (int i = 1; i <= n; i++) {
    flag |= (dp[1][i][1] & dp[i][n][0]);
  }
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
