#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
int gcd(int a, int b) {
  for (; b; swap(a, b)) a %= b;
  return a;
}
int a, b, c, d, n, m, k;
bool mem[702][702][2];
bool g[702][702];
int mas[702];
int main() {
  scanf("%d", &n);
  for (int _n((n)-1), i(0); i <= _n; i++) {
    scanf("%d", &mas[i]);
  }
  for (int _n((n + 1) - 1), i(0); i <= _n; i++) {
    for (int _n((i + 1) - 1), j(0); j <= _n; j++) {
      g[i][j] = g[j][i] = (gcd(mas[i], mas[j]) > 1);
    }
  }
  for (int i = (n - 1), _b = (0); i >= _b; i--) {
    mem[i][i][0] = i > 0 ? g[i][i - 1] : 0;
    mem[i][i][1] = g[i][i + 1];
    for (int _n(n - 1), j(i + 1); j <= _n; j++) {
      for (int _n((2) - 1), o(0); o <= _n; o++) {
        if (!i && !o) continue;
        int pos = o ? j + 1 : i - 1;
        for (int _n(j - 1), z(i + 1); z <= _n; z++) {
          if (mas[z] == mas[z - 1]) continue;
          if (!g[pos][z]) continue;
          if (mem[i][z - 1][1] && mem[z + 1][j][0]) {
            mem[i][j][o] = 1;
            break;
          }
        }
        if (mem[i][j][o]) continue;
        if (g[pos][i] && mem[i + 1][j][0]) {
          mem[i][j][o] = 1;
          continue;
        }
        if (g[pos][j] && mem[i][j - 1][1]) {
          mem[i][j][o] = 1;
          continue;
        }
      }
    }
  }
  if (mem[0][n - 1][1])
    printf("Yes\n");
  else
    printf("No\n");
}
