#include <bits/stdc++.h>
const int N = 705;
int n, v[N], e[N][N], f[N][N][2];
inline bool pg(int x, int y) {
  for (int z; y; z = x % y, x = y, y = z)
    ;
  return x > 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) e[i][j] = pg(v[i], v[j]);
  for (int i = 0; i <= n; ++i) f[i + 1][i][0] = f[i + 1][i][1] = 1;
  for (int i = 1; i <= n; ++i)
    f[i][i][0] = e[i - 1][i], f[i][i][1] = e[i][i + 1];
  for (int l = 2; l <= n; ++l)
    for (int i = 1, j = i + l - 1; j <= n; ++i, ++j)
      for (int k = i; k <= j; ++k)
        f[i][j][0] |= e[i - 1][k] & f[i][k - 1][1] & f[k + 1][j][0],
            f[i][j][1] |= e[k][j + 1] & f[i][k - 1][1] & f[k + 1][j][0];
  f[1][n][0] ? printf("Yes") : printf("No");
  return 0;
}
