#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for(auto &&v : a) cin >> v; for(int i = 0; i + 2 < n; i++){ if(a[i] == a[i + 2]){ cout << "Yes\n"; return 0; } } for(int i = 0; i + 1 < n; i++){ if(a[i] == a[i + 1]){ cout << "Yes\n"; return 0; } } cout << "No\n"; }