#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int n, a[710];
bool flag[710][710], f[710][710][2];
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int main() {
  const char LL[] = "%lld\n";
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (gcd(a[i], a[j]) > 1) flag[i][j] = 1;
  for (int i = 1; i <= n + 1; i++) f[i][i - 1][0] = f[i][i - 1][1] = 1;
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n - k + 1; i++) {
      int j = i + k - 1;
      for (int d = i; d <= j; d++)
        if (f[i][d - 1][1] && f[d + 1][j][0]) {
          if (flag[i - 1][d]) f[i][j][0] = 1;
          if (flag[j + 1][d]) f[i][j][1] = 1;
        }
    }
  for (int i = 1; i <= n; i++)
    if (f[1][i - 1][1] && f[i + 1][n][0]) {
      cout << "Yes";
      return 0;
    }
  cout << "No";
  return 0;
}
