#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include #include using namespace atcoder; using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (ll)n; i++) #define all(v) v.begin(),v.end() const ll INF = (ll)2e18; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N; string S; cin >> N >> S; if(N%2==1){ cout << "No" << endl; return 0; } ll cnt = 0; rep(i,N){ if(S[i]=='('){ cnt++; } } if(cnt!=N-cnt){ cout << "No" << endl; return 0; } if(S[0]==')'){ cout << "No" << endl; return 0; } ll num = 0; rep(i,N){ if(S[i]=='('){ num++; } else{ num--; } if(num<0){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; }