#include <bits/stdc++.h>
using namespace std;
constexpr int MAX_N = 705;
int n;
int arr[MAX_N];
int adj[MAX_N][MAX_N];
int dp[MAX_N][MAX_N][2];
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  scanf(" %d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf(" %d", &arr[i]);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (gcd(arr[i], arr[j]) > 1) {
        adj[i][j] = true;
      }
    }
    adj[0][i] = true;
    adj[i][0] = true;
  }
  for (int len = 1; len <= n; ++len) {
    for (int i = 1; i <= n; ++i) {
      for (int side = 0; side <= 1; ++side) {
        int j = i + len - 1;
        if (j > n) continue;
        int prev = side ? j + 1 : i - 1;
        for (int k = i; k <= j; ++k) {
          if (!adj[prev][k]) continue;
          bool cur = true;
          if (k > i) cur &= dp[i][k - 1][1];
          if (k < j) cur &= dp[k + 1][j][0];
          dp[i][j][side] |= cur;
        }
      }
    }
  }
  printf("%s\n", dp[1][n][0] ? "Yes" : "No");
  return 0;
}
