n=int(input()) s=input() q=[] for c in s: q+=c, if q[-2:]==[*'()']: q.pop() q.pop() if not q: print('Yes') else: print('No')