#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m[100], i;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> m[i];
  for (int i = 0; i < n; i++)
    if (m[i] != (m[i] * m[i + 1] / 4)) cout << "NO";
  if (m[i] == (m[i] * m[i + 1] / 4)) cout << "yes";
}
