#include <bits/stdc++.h>
using namespace std;
unsigned long long int a, b, c, cnt, cn, ct;
int main() {
  cin >> a;
  unsigned long long int ar[a];
  for (int i = 0; i < a; i++) {
    cin >> c;
    ar[c]++;
    cnt = 0;
    if (ar[c] % 4 == 0) cnt++;
    if (cnt > 0) {
      cn++;
    }
  }
  if (cn > 0)
    cout << "YES";
  else
    cout << "NO";
}
