#include <bits/stdc++.h>
using namespace std;
long long a[1005];
int G[1005][1005];
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
int dp[1005][1005][2];
int main() {
  int n;
  scanf("%d", &(n));
  ;
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &(a[i]));
    ;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      G[i][j] = gcd(a[i], a[j]) > 1;
    }
  }
  for (int i = 0; i <= n + 1; i++) {
    for (int j = 0; j <= n + 1; j++) {
      if (i > j) dp[i][j][0] = dp[i][j][1] = 1;
    }
  }
  for (int len = 1; len <= n; len++) {
    for (int l = 1; l + len - 1 <= n; l++) {
      int r = l + len - 1;
      if (l == r) {
        if (l > 1 && G[l][l - 1]) dp[l][l][0] = 1;
        if (r < n && G[l][l + 1]) dp[l][l][1] = 1;
        continue;
      }
      if (r < n)
        for (int k = l; k <= r; k++) {
          if (G[k][r + 1] && dp[l][k - 1][1] && dp[k + 1][r][0]) {
            dp[l][r][1] = 1;
            break;
          }
        }
      if (l > 1)
        for (int k = l; k <= r; k++) {
          if (G[k][l - 1] && dp[l][k - 1][1] && dp[k + 1][r][0]) {
            dp[l][r][0] = 1;
            break;
          }
        }
    }
  }
  int flag = 0;
  for (int k = 1; k <= n; k++) {
    if (dp[1][k - 1][1] && dp[k + 1][n][0]) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
