#include <bits/stdc++.h>
using namespace std;
const int MAXN = 710;
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int dp[MAXN][MAXN][2];
int ddiv[MAXN][MAXN];
void Run() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) ddiv[i][j] = gcd(a[i], a[j]);
  for (int i = 1; i <= n + 1; ++i) dp[i][i - 1][0] = dp[i][i - 1][1] = 1;
  for (int lft = n; lft >= 1; --lft) {
    for (int rgt = lft; rgt <= n; ++rgt) {
      for (int side = 0; side < 2; ++side) {
        int v = (!side ? lft - 1 : rgt + 1);
        for (int x = lft; x <= rgt; ++x) {
          if (v <= 0 || v > n || ddiv[x][v] > 1) {
            dp[lft][rgt][side] |= (dp[lft][x - 1][1] & dp[x + 1][rgt][0]);
          }
        }
      }
    }
  }
  cout << (dp[1][n][0] ? "Yes" : "No") << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  Run();
  return 0;
}
