#include using namespace std; #define in(T,V) T V;cin>>V; int main(){ in(int,N); in(string,s); cout << ([&]()->bool{ return s.find("00") != string::npos || s.find("11") != string::npos || s.find("0101") != string::npos || s.find("1010") != string::npos; }()?"YES":"NO") << endl; }