#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
bitset<maxn> f[maxn][maxn], can[maxn];
int a[maxn], n, has[maxn][maxn], val[2][maxn][maxn];
int gcd(int x, int y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
int GetL(int l, int r) {
  if (val[0][l][r] != -1) return val[0][l][r];
  if ((f[l][r] & can[r + 1]).count())
    val[0][l][r] = 1;
  else
    val[0][l][r] = 0;
  return val[0][l][r];
}
int GetR(int l, int r) {
  if (val[1][l][r] != -1) return val[1][l][r];
  if ((f[l][r] & can[l - 1]).count())
    val[1][l][r] = 1;
  else
    val[1][l][r] = 0;
  return val[1][l][r];
}
void calc(int l, int r) {
  if (l > r) return;
  if (has[l][r]) return;
  has[l][r] = 1;
  for (int i = l; i <= r; i++) {
    calc(l, i - 1);
    calc(i + 1, r);
    if ((i == l || GetL(l, i - 1)) && (i == r || GetR(i + 1, r)))
      f[l][r][i] = 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (gcd(a[i], a[j]) > 1) can[i][j] = 1;
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < maxn; j++)
      for (int k = 0; k <= 1; k++) val[k][i][j] = -1;
  calc(1, n);
  if (f[1][n].count())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
