#include <bits/stdc++.h>
using namespace std;
const int N = 3000;
int T, n;
int a[N], Gcd[N][N];
bool pd;
bool f[N][N][2];
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  T = 1;
  while (T--) {
    scanf("%d", &n);
    memset(f, 0, sizeof(f));
    for (int i = 1; i <= n; i++)
      scanf("%d", &a[i]), f[i][i][0] = f[i][i][1] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) Gcd[i][j] = gcd(a[i], a[j]);
    pd = 0;
    for (int i = 1; i <= n; i++) {
      for (int l = 1; l + i - 1 <= n; l++) {
        int r = l + i - 1;
        for (int p = l; p <= r; p++)
          if (f[l][p][0] && f[p][r][1]) {
            if (l == 1 && r == n) {
              pd = 1;
              break;
            }
            if (Gcd[l - 1][p] != 1) f[l - 1][r][1] = 1;
            if (Gcd[p][r + 1] != 1) f[l][r + 1][0] = 1;
          }
        if (pd) break;
      }
      if (pd) break;
    }
    puts(pd ? "Yes" : "No");
  }
  return 0;
}
