#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; string S; cin >> N >> S; stack st; rep(i, 0, N) { if (S[i] == '(') st.push('('); else { if (!st.empty() && st.top() == '(') st.pop(); else st.push(')'); } } if (st.empty()) cout << "Yes\n"; else cout << "No\n"; }