#include <bits/stdc++.h>
using namespace std;
int dp[708][708][2], n, a[708], p[708][708];
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (gcd(a[i], a[j]) >= 2) p[i][j] = 1;
    }
  }
  for (int i = 1; i <= n + 1; i++) {
    dp[i][i - 1][0] = 1;
    dp[i][i - 1][1] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int L = 1; L <= n - i; L++) {
      int R = L + i;
      for (int r = L; r <= R; r++) {
        if (dp[L][r - 1][1] == 1 && dp[r + 1][R][0] == 1) {
          if (p[r][L - 1] == 1) dp[L][R][0] = 1;
          if (p[r][R + 1] == 1) dp[L][R][1] = 1;
          if (L == 1 && R == n) {
            cout << "Yes" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
