#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int dp[700][700][2];
int n, arr[700];
bool edge[700][700];
bool helper(int start, int end, int side) {
  if (start == end) {
    if (side == 1 && edge[start][start + 1])
      return 1;
    else if (side == 1)
      return 0;
    if (side == 0 && edge[start][start - 1]) return 1;
    return 0;
  }
  if (dp[start][end][side] != -1) return dp[start][end][side];
  int &ans = dp[start][end][side];
  ans = 0;
  if (side == 1) {
    for (int i = start; i < end + 1; i++) {
      if (edge[i][end + 1] == false) continue;
      if ((start == i || helper(start, i - 1, 1)) &&
          (end == i || helper(i + 1, end, 0))) {
        return ans = 1;
      }
    }
    return ans = 0;
  } else {
    for (int i = start; i < end + 1; i++) {
      if (edge[i][start - 1] == false) continue;
      if ((start == i || helper(start, i - 1, 1)) &&
          (end == i || helper(i + 1, end, 0))) {
        return ans = 1;
      }
    }
    return ans = 0;
  }
}
void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (gcd(arr[i], arr[j]) > 1) {
        edge[i][j] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if ((i == 0 || helper(0, i - 1, 1)) &&
        (i == (n - 1) || helper(i + 1, n - 1, 0))) {
      cout << "Yes";
      return;
    }
  }
  cout << "No";
}
int main() {
  std::ios::sync_with_stdio(false);
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
