#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG // []で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意 #endif #include using namespace std; // #include // using namespace atcoder; // #include // using namespace boost::multiprecision; using ll = long long; using Graph = vector>; ll INF = 2e18 + 1; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,cnt=0; string S; cin >> N >> S; bool ok = true; if (N % 2 == 1) ok = false; for (int i = 0; i < N; i++){ if(S[i]=='(') cnt++; else cnt--; if(cnt<0) ok = false; } if(ok&&cnt==0) cout << "Yes" << endl; else cout << "No" << endl; }