#include #include using namespace std; static inline constexpr const char* solve(const uint32_t N, const string& S) noexcept { uint32_t count[2] = { 0, 0 }; for (uint32_t i = 0; i != N; ++i) switch (S[i]) { case '(': ++count[0]; break; case ')': ++count[1]; break; } if (count[0] == count[1]) return "Yes"; else return "No"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint32_t N; string S; cin >> N; S.reserve(N), cin >> S; cout << solve(N, S) << '\n'; return 0; }