#include <bits/stdc++.h>
using namespace std;
void judge() {
  freopen("name.in", "r", stdin);
  freopen("name.out", "w", stdout);
}
inline void read(int &x) {
  x = 0;
  int fg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') fg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= fg;
}
int n, a[710], lf[710][710], rf[710][710], pre[710][710];
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  read(n);
  for (int i = (1); i <= (n); i++) read(a[i]);
  for (int i = (1); i <= (n); i++)
    for (int j = (i + 1); j <= (n); j++) {
      if (gcd(a[i], a[j]) > 1) pre[i][j] = pre[j][i] = 1;
    }
  for (int i = (1); i <= (n); i++) lf[i][i] = rf[i][i] = 1;
  for (int len = (1); len <= (n); len++) {
    for (int i = (1); i <= (n); i++) {
      if (i + len - 1 > n) break;
      int j = i + len - 1;
      for (int k = (i); k <= (j); k++) {
        if (lf[k][i] && rf[k][j]) {
          if (len == n) return puts("Yes"), 0;
          rf[i - 1][j] |= pre[i - 1][k];
          lf[j + 1][i] |= pre[k][j + 1];
        }
      }
    }
  }
  puts("No");
  return 0;
}
