#include <bits/stdc++.h>
using namespace std;
int n;
int a[1000];
int mygcd[1000][1000];
int possiblel[1000][1000];
int possibler[1000][1000];
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(mygcd, 0, sizeof(mygcd));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      mygcd[i][j] = (gcd(a[i], a[j]) > 1);
    }
  }
  memset(possiblel, 0, sizeof(possiblel));
  memset(possibler, 0, sizeof(possibler));
  for (int d = 0; d <= n - 1; d++) {
    for (int l = 1; l <= n - d; l++) {
      int r = l + d;
      for (int m = l; m <= r; m++) {
        int ans1 = 0, ans2 = 0;
        if (m == l)
          ans1 = 1;
        else
          ans1 = possibler[l][m - 1];
        if (m == r)
          ans2 = 1;
        else
          ans2 = possiblel[m + 1][r];
        possiblel[l][r] |= (ans1 & ans2 & mygcd[m][l - 1]);
        possibler[l][r] |= (ans1 & ans2 & mygcd[m][r + 1]);
      }
    }
  }
  int ans = 0;
  for (int m = 1; m <= n; m++) {
    int ans1 = 0;
    int ans2 = 0;
    if (m == 1)
      ans1 = 1;
    else
      ans1 = possibler[1][m - 1];
    if (m == n)
      ans2 = 1;
    else
      ans2 = possiblel[m + 1][n];
    ans |= (ans1 & ans2);
  }
  if (ans == 0)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
