#include <bits/stdc++.h>
using namespace std;
int n, a[701];
bool f[701][701], l[701][701], r[701][701];
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), l[i][i] = r[i][i] = true;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) f[i][j] = f[j][i] = (gcd(a[i], a[j]) > 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++)
      for (int k = j - i; k <= j - 1; k++)
        if (f[j][k] & l[k][j - i] & r[k][j - 1]) l[j][j - i] = true;
    for (int j = 1; j <= n - i; j++)
      for (int k = j + 1; k <= j + i; k++)
        if (f[j][k] & l[k][j + 1] & r[k][j + i]) r[j][j + i] = true;
  }
  for (int i = 1; i <= n; i++)
    if (l[i][1] && r[i][n]) return printf("Yes\n"), 0;
  return printf("No\n"), 0;
}
