#include #include #include using namespace std; setcheck[1001]; set::iterator it; int num[1000]; int main() { int n; while(scanf("%d", &n) != EOF) { for (int i = 0 ; i <= 1000 ; i++)check[i].clear(); for (int i = 0 ; i < n ; i++) { scanf("%d", &num[i]); check[num[i]].insert(i); } bool has = false; for (int i = 0 ; i < n ; i++) { for(int j = 0 ; j < n ; j++) { if ( i == j ) continue; if(num[i] - num[j] > 0) { int x = num[i] - num[j]; for(it = check[x].begin() ; it != check[x].end() ; it++) { if( *it == i || *it == j)continue; has = true; break; } } } if (has) break; } printf("%s\n",has ? ("YES") : ("NO")); } return 0; }