#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const int ddx[8] = {0, 0, 1, 1, 1, -1, -1, -1},
          ddy[8] = {1, -1, 1, 0, -1, 1, 0, -1};
const int INF = 0x7f7f7f7f;
const long long INF_LL = 0x7f7f7f7f7f7f7f7f;
long long POW(long long a, long long b, long long MMM) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a / GCD(a, b) * b;
}
long long INV(long long a, long long m) {
  long long m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
pair<long long, long long> EXGCD(long long a, long long b) {
  if (b == 0) return {1, 0};
  auto t = EXGCD(b, a % b);
  return {t.second, t.first - t.second * (a / b)};
}
bool OOB(long long x, long long y, long long N, long long M) {
  return 0 > x || x >= N || 0 > y || y >= M;
}
bool L[701][701];
bool R[701][701];
int N;
int A[701];
int g[701][701];
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    L[i][i] = R[i][i] = 1;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      g[i][j] = GCD(A[i], A[j]);
    }
  }
  for (int gap = 1; gap < N; gap++) {
    for (int st = 0; st < N - gap; st++) {
      int en = st + gap;
      if (g[en][en - 1] > 1 and L[st][en - 1])
        L[st][en] = 1;
      else {
        if (g[st][en] > 1 and R[st][en - 1])
          L[st][en] = 1;
        else {
          for (int root = st + 1; root < en - 1; root++) {
            if (g[en][root] > 1 && L[st][root] && R[root][en - 1]) {
              L[st][en] = 1;
              break;
            }
          }
        }
      }
      if (g[st][en] > 1 and L[st + 1][en])
        R[st][en] = 1;
      else {
        if (g[st][st + 1] > 1 and R[st + 1][en])
          R[st][en] = 1;
        else {
          for (int root = st + 2; root < en; root++) {
            if (g[st][root] > 1 && L[st + 1][root] && R[root][en]) {
              R[st][en] = 1;
              break;
            }
          }
        }
      }
    }
  }
  if (L[0][N - 1]) {
    cout << ("Yes") << '\n';
    return 0;
  }
  if (R[0][N - 1]) {
    cout << ("Yes") << '\n';
    return 0;
  }
  for (int root = 1; root < N - 1; root++) {
    if (L[0][root] and R[root][N - 1]) {
      cout << ("Yes") << '\n';
      return 0;
    }
  }
  cout << ("No") << '\n';
}
