#include using namespace std; int main() { int N; cin >> N; string S; cin >> S; assert(1 <= N && N <= 100000); assert(S.size() == N); if (N % 2 == 1) { cout << "No" << endl; return 0; } int open = 0; int close = 0; for (int i = 0; i < N; i++) { if (S[i] == '(') { open++; } else { open--; close++; } if (open < 0) { cout << "No" << endl; return 0; } } cout << (open == 0 && close == N / 2 ? "Yes" : "No") << endl; }