#include <bits/stdc++.h>
using namespace std;
int n;
int a[702], g[702][702];
int f[702][702][2];
int gcd(int x, int y) {
  if (!y)
    return x;
  else
    return gcd(y, x % y);
}
bool dfs(int l, int r, int x) {
  int t;
  if (l > r) return 1;
  if (x == 0)
    t = l - 1;
  else
    t = r + 1;
  if (t < 1 || t > n) return 0;
  if (f[l][r][x] >= 0) return f[l][r][x];
  for (int i = l; i <= r; ++i)
    if (g[t][i] > 1 && dfs(l, i - 1, 1) && dfs(i + 1, r, 0))
      return f[l][r][x] = 1;
  return f[l][r][x] = 0;
}
int main() {
  scanf("%d\n", &n);
  memset(f, -1, sizeof(f));
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) g[i][j] = gcd(a[i], a[j]);
  for (int i = 1; i <= n; ++i)
    if (dfs(1, i - 1, 1) && dfs(i + 1, n, 0)) {
      printf("Yes");
      return 0;
    }
  printf("No");
  return 0;
}
