#include <bits/stdc++.h>
using namespace std;
long long a[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 search(int l, int r, int side) {
  if (l > r) return dp[l][r][side] = 1;
  if (l == r) {
    if (side == 1)
      return dp[l][r][side] = gcd(a[r], a[r + 1]) > 1;
    else
      return dp[l][r][side] = gcd(a[l], a[l - 1]) > 1;
  }
  if (dp[l][r][side] > -1) return dp[l][r][side];
  int flag = 0;
  for (int i = l; i <= r; i++) {
    if (side == 1) {
      if (gcd(a[r + 1], a[i]) > 1 && search(l, i - 1, 1) &&
          search(i + 1, r, 0)) {
        return dp[l][r][side] = 1;
      }
    } else {
      if (gcd(a[l - 1], a[i]) > 1 && search(l, i - 1, 1) &&
          search(i + 1, r, 0)) {
        return dp[l][r][side] = 1;
      }
    }
  }
  return dp[l][r][side] = 0;
}
int main() {
  int n;
  scanf("%d", &(n));
  ;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &(a[i]));
    ;
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    if (search(1, i - 1, 1) && search(i + 1, n, 0)) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "Yes";
  else
    cout << "No";
}
