/* -*- coding: utf-8 -*- * * 3286.cc: No.3286 Make a Happy Connection - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 500; /* typedef */ /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); bool ok = false; for (int i = 0; ! ok && i < n; i++) ok = (i + 1 < n && as[i] == as[i + 1]) || (i + 2 < n && as[i] == as[i + 2]); if (ok) puts("Yes"); else puts("No"); return 0; }