#include <bits/stdc++.h>
using namespace std;
unsigned gcd(unsigned a, unsigned b) {
  unsigned r;
  do {
    r = a % b;
    a = b;
    b = r;
  } while (r > 0);
  return a;
}
unsigned arr[705];
bool dp[705][705][2];
bool en[705][705][2];
unsigned g[705][705];
bool f(int l, int r, int rm) {
  if (en[l][r][rm]) return dp[l][r][rm];
  en[l][r][rm] = true;
  if (l == r)
    dp[l][r][rm] = g[l][l - 1 + 2 * rm] > 1;
  else {
    dp[l][r][rm] |= (g[l - 1 + rm * (r - l + 2)][l] > 1) && f(l + 1, r, 0);
    dp[l][r][rm] |= (g[l - 1 + rm * (r - l + 2)][r] > 1) && f(l, r - 1, 1);
    for (int curs = 1; curs < r - l; curs++)
      dp[l][r][rm] |= (g[l - 1 + rm * (r - l + 2)][l + curs] > 1) &&
                      f(l, l + curs - 1, 1) && f(l + curs + 1, r, 0);
  }
  return dp[l][r][rm];
}
void init(int n) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) g[i][j] = gcd(arr[i], arr[j]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  init(n);
  if (f(1, n - 1, 0)) {
    printf("Yes\n");
    return 0;
  }
  if (f(0, n - 2, 1)) {
    printf("Yes\n");
    return 0;
  }
  for (int i = 1; i < n - 1; i++) {
    if (f(0, i - 1, 1) && f(i + 1, n - 1, 0)) {
      printf("Yes\n");
      return 0;
    } else
      continue;
  }
  printf("No\n");
  return 0;
}
