#include <bits/stdc++.h>
using namespace std;
const int MAX = 702;
const int INFint = 0x3f3f3f3f;
const long long INFll = 0x3f3f3f3f3f3f3f3f;
int n, dp[MAX][MAX][2], a[MAX], m[MAX][MAX];
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) m[i][j] = gcd(a[i], a[j]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= n - i; j++)
      for (int p = 0; p < 2; p++) {
        int x = j, y = j + i, u = p ? y : x - 1;
        if (x == y) dp[x][y][p] = 1;
        if (u < 0 || u >= n) continue;
        for (int i = x; i < y; i++)
          if (dp[x][i][1] && dp[i + 1][y][0] && m[u][i] != 1) dp[x][y][p] = 1;
      }
  for (int i = 0; i < n; i++)
    if (dp[0][i][1] && dp[i + 1][n][0]) {
      printf("Yes\n");
      return 0;
    }
  printf("No\n");
  return 0;
}
