#include <bits/stdc++.h>
using namespace std;
void use_cio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
template <typename... Args>
void dbg(Args... args) {
  ((cout << args << " "), ...);
  cout << endl;
}
int n;
int a[710];
int adj[710][710], dp[2][710][710];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
bool solve(int t, int l, int r) {
  if (r == l) return 1;
  if (dp[t][l][r] > -1) return dp[t][l][r];
  int root = t ? l - 1 : r;
  if (root < 0) return 0;
  for (int j = (l); j < (r); j++) {
    if (adj[j][root]) {
      if (solve(0, l, j) && solve(1, j + 1, r)) return dp[t][l][r] = 1;
    }
  }
  return dp[t][l][r] = 0;
}
int main() {
  use_cio();
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int i = 0; i < (n + 1); i++)
    for (int j = 0; j < (n + 1); j++) {
      if (gcd(a[i], a[j]) > 1) {
        adj[i][j] = adj[j][i] = 1;
      }
    }
  memset(dp, -1, sizeof(dp));
  cout << (solve(0, 0, n) ? "Yes" : "No");
}
