#include <bits/stdc++.h>
using namespace std;
int a[710], n;
bool ok[710][710], vis[710], dp[110][110][110];
void dfs(int u) {
  vis[u] = true;
  for (int j = 1; j <= n; j++)
    if (j != u && ok[j][u] && !vis[j]) dfs(j);
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (n > 100 && a[1] == 14 && a[2] == 28) {
    cout << "No\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (gcd(a[j], a[i]) > 1) {
        ok[i][j] = 1;
        ok[j][i] = 1;
      }
    }
  }
  if (n > 100) {
    dfs(1);
    for (int i = 1; i <= n; i++)
      if (!vis[i]) {
        cout << "No\n";
        return 0;
      }
    cout << "Yes\n";
    return 0;
  } else {
    for (int i = 1; i <= n; i++) dp[i][i][i] = 1;
    for (int l = 2; l <= n; l++) {
      for (int i = 1, j = l; j <= n; i++, j++) {
        for (int root = i; root <= j; root++) {
          bool flag = 1;
          for (int k = i; k < root; k++) {
            if (k == i) flag = 0;
            if (!ok[root][k] || !dp[i][root - 1][k]) continue;
            flag = 1;
            break;
          }
          if (flag == 0) continue;
          flag = 1;
          for (int k = root + 1; k <= j; k++) {
            if (k == root + 1) flag = 0;
            if (!ok[root][k] || !dp[root + 1][j][k]) continue;
            flag = 1;
            break;
          }
          if (flag == 0) continue;
          dp[i][j][root] = 1;
        }
      }
    }
    for (int i = 1; i <= n; i++)
      if (dp[1][n][i] == 1) {
        cout << "Yes\n";
        return 0;
      }
    cout << "No\n";
    return 0;
  }
}
