#include <bits/stdc++.h>
int a[709];
int f[709][709][2], can[709][709];
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
signed 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 = 1; j <= n; j++) {
      can[i][j] = gcd(a[i], a[j]) > 1;
    }
  }
  for (int i = 1; i <= n + 1; i++) {
    f[i][i - 1][0] = f[i][i - 1][1] = 1;
    f[i][i][0] = can[i][i - 1];
    f[i][i][1] = can[i][i + 1];
  }
  int i, j, x, len;
  for (len = 1; len <= n; len++) {
    for (i = 1; i + len <= n; i++) {
      j = i + len;
      for (x = i; x <= j; x++) {
        f[i][j][0] |= f[i][x - 1][1] & f[x + 1][j][0] & can[x][i - 1];
        f[i][j][1] |= f[i][x - 1][1] & f[x + 1][j][0] & can[x][j + 1];
      }
    }
  }
  int ans = 0;
  for (int x = 1; x <= n; x++) {
    ans |= f[1][x - 1][1] & f[x + 1][n][0];
  }
  puts(ans ? "Yes" : "No");
  return 0;
}
