#include <bits/stdc++.h>
using namespace std;
int vis[709][709][2], a[709], val[709][709], n;
bool dp[709][709][2];
int gcd(int a1, int b1) {
  if (a1 == 0) return b1;
  return gcd(b1 % a1, a1);
}
bool comp(int idx, int par, int left) {
  int i, j, l1, r1, t1, t2, t3, t4;
  bool buf1, buf2, buf3, buf4;
  if (vis[idx][par][left]) {
    return dp[idx][par][left];
  }
  if (left) {
    l1 = par + 1;
    r1 = idx;
  } else {
    r1 = par - 1;
    l1 = idx;
  }
  if (l1 > r1) {
    return true;
  } else if (l1 == r1) {
    return (val[min(l1, par)][max(l1, par)] > 1);
  }
  vis[idx][par][left] = 1;
  buf1 = false;
  for (i = l1; i <= r1; i++) {
    buf2 = comp(l1, i, 0) & comp(r1, i, 1);
    buf3 = (val[min(i, par)][max(i, par)] > 1);
    buf2 &= buf3;
    buf1 |= buf2;
    if (buf1) {
      break;
    }
  }
  return dp[idx][par][left] = buf1;
}
int main() {
  int i, j, t1, t2, t3, t4;
  bool temper, yay = false;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      val[i][j] = gcd(a[i], a[j]);
    }
  }
  for (i = 0; i < n; i++) {
    temper = comp(0, i, 0) & comp(n - 1, i, 1);
    yay |= temper;
    if (yay) {
      break;
    }
  }
  if (yay) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}
