#include <bits/stdc++.h>
using namespace std;
int can[1010][1010], f[1010][1010][2], a[1010];
inline int read() {
  char c = getchar();
  int x = 0, flag = 1;
  while (!isdigit(c)) {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * flag;
}
int gg(int a, int b) {
  if (b == 0) return a;
  return gg(b, a % b);
}
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (gg(a[i], a[j]) > 1) can[i][j] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    f[i][i][0] = f[i][i][1] = 1;
  }
  for (int len = 2; len <= n; len++) {
    for (int i = 1; i + len - 1 <= n; i++) {
      int j = i + len - 1;
      for (int k = i + 1; k <= j; k++) {
        if (can[k][i] && f[i + 1][k][1] && f[k][j][0]) {
          f[i][j][0] = 1;
          break;
        }
      }
      for (int k = i; k < j; k++) {
        if (can[k][j] && f[i][k][1] && f[k][j - 1][0]) {
          f[i][j][1] = 1;
          break;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (f[1][i][1] && f[i][n][0]) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}
