Petya's friends made him a birthday present — a bracket sequence. Petya was quite disappointed with his gift, because he dreamed of correct bracket sequence, yet he told his friends nothing about his dreams and decided to fix present himself. 

To make everything right, Petya is going to move at most one bracket from its original place in the sequence to any other position. Reversing the bracket (e.g. turning "(" into ")" or vice versa) isn't allowed. 

We remind that bracket sequence $s$ is called correct if:   $s$ is empty;  $s$ is equal to "($t$)", where $t$ is correct bracket sequence;  $s$ is equal to $t_1 t_2$, i.e. concatenation of $t_1$ and $t_2$, where $t_1$ and $t_2$ are correct bracket sequences. 

For example, "(()())", "()" are correct, while ")(" and "())" are not. Help Petya to fix his birthday present and understand whether he can move one bracket so that the sequence becomes correct.


-----Input-----

First of line of input contains a single number $n$ ($1 \leq n \leq 200\,000$) — length of the sequence which Petya received for his birthday.

Second line of the input contains bracket sequence of length $n$, containing symbols "(" and ")".


-----Output-----

Print "Yes" if Petya can make his sequence correct moving at most one bracket. Otherwise print "No".


-----Examples-----
Input
2
)(

Output
Yes

Input
3
(()

Output
No

Input
2
()

Output
Yes

Input
10
)))))(((((

Output
No



-----Note-----

In the first example, Petya can move first bracket to the end, thus turning the sequence into "()", which is correct bracket sequence.

In the second example, there is no way to move at most one bracket so that the sequence becomes correct.

In the third example, the sequence is already correct and there's no need to move brackets.

Difficulty: competition

Starter code:

Solutions:
n=int(input())
s=input()
stack=[]
for i in s:
	if i=="(":
		stack.append(i)
	elif i==")":
		if len(stack)>0:
			if (stack[-1]=="("):
				stack.pop()
			else:
				stack.append(")")
		else:
			stack.append(")")
if len(stack)==0:
	print ("Yes")
	return
if len(stack)==2:
	if stack[0]==")" and stack[1]=="(":
		print ("Yes")
		return
	else:
		print ("No")
		return
else:
	print ("No")

n = int(input())
s = input()

diff = 0
min_diff = 0

for i in range(n):
    if s[i] == "(": diff += 1
    else:
        diff -= 1
        min_diff = min([min_diff, diff])
        
if min_diff >= -1 and diff == 0: print("Yes")
else: print("No")

n=int(input())
s=input()
if s.count('(')!=s.count(')'):
    print('No')
    return 
stk=[] 
karma=0 
f=1 
ans=1 
for i in s:
    if i=='(': 
        stk.append(i)
    else:
        if not stk:
            f=0 
            if not karma: 
                karma=1 
            else:
                ans=0 
                break 
        else:
            stk.pop() 
if ans and len(stk)==1 and stk[0]=='(':
    print('Yes')
    return 
if not stk and f :
    f=1 
if f:
    print('Yes')
    return 
if not ans:
    print('No')
    return

from itertools import accumulate
n = int(input())
s = [1 if c == '(' else -1 for c in input()]
res = sum(s) == 0
if res:
    l = [*accumulate(s)]
    m = min(l)
    res &= m >= -1
print('Yes' if res else 'No')



n = int(input())
s = input()

cur = 0

for ch in s:

    if ch == '(':
        cur += 1
    else:
        cur -= 1
    
    if cur == -2:
        print("No")
        return

print("Yes" if cur == 0 else "No")

import sys
input = sys.stdin.readline


n = int(input())
S = input().strip()

NOW = 0
SC=[]

for s in S:
    if s=="(":
        NOW+=1
    else:
        NOW-=1
    SC.append(NOW)


    
if SC[-1]==0 and min(SC)>=-1:
    print("Yes")
else:
    print("No")


import sys

input()
c = input()


if not "(" in c:
    print("No")
    return

last = c.rfind("(")

corr = "(" + c[:last] + c[last + 1 :]

sums = 0
for br in corr:
    if br == "(":
        sums += 1
    else:
        sums -= 1
    if sums < 0:
        print("No")
        return

print("Yes" if sums == 0 else "No")



n = int(input())
present = input().rstrip()
level = 0
min_level = 0
for ch in present:
    if ch == "(":
        level += 1
    else:
        level -= 1
        min_level = min(min_level, level)

if min_level >= -1 and level == 0:
    print("Yes")
else:
    print("No")

def solvea():
    n = int(input())
    d = int(input())
    e = 5 * int(input())
    best = 0
    for enr in range(n // e + 1):
        curr = e * enr
        curr += d * ((n - curr) // d)
        if curr <= n and curr > best:
            best = curr
    print(n - best)


def solveb():
    a = int(input())
    b = int(input())
    n = int(input())
    ans = 0
    for i in range(a + 1):
        for j in range(b + 1):
            if i + j == n:
                ans += 1
    print(ans)


def solvec():
    n = int(input())
    curr_bal = 0
    min_bal = 0
    for e in input():
        if e == '(':
            curr_bal += 1
        else:
            curr_bal -= 1
        if curr_bal < min_bal:
            min_bal = curr_bal
    if min_bal >= -1 and curr_bal == 0:
        print('Yes')
    else:
        print('No')


def __starting_point():
    solvec()

__starting_point()

N = int(input())
S = list(input())

lnum = len([x for x in S if x == "("])
rnum = len([x for x in S if x == ")"])
if lnum != rnum:
    print("No")
    return

lcnt = 0
rcnt = 0
for x in S:
    if x == "(":
        lcnt += 1
    else:
        if lcnt > 0:
            lcnt -= 1
        else:
            rcnt += 1

if rcnt > 1:
    print("No")
else:
    print("Yes")

len = int(input())
s = input()

st = neg = 0
for i in s:
    if i == '(':
        st += 1
    else:
        st -= 1
    
    neg = min(neg, st)

if st != 0 or neg < -1:
    print("No")
else:
    print("Yes")

n = int(input())
s= input()

depth = 0
ig = False
for i in range(n):
    if(not ig and s[i] == ')' ):
        ig = True
        continue
    if(s[i] == '('):
        depth +=1
    else:
        depth -= 1
    if(depth < 0):
        print('No')
        return
if(ig): depth -= 1

if(depth):
    print('No')
else:
    print('Yes')

n = int(input())
m = input()
m = list(m)
if n%2==0:
    d = 0
    for i in range(n):
        if m[i]=='(':
            d+=1
        if m[i]==')':
            d-=1
            if d <-1:
                d -= 400001         
    if d == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

n = int(input())
s = list(input())
if n % 2 == 1:
    print("No")
    return

s = [0 if x == "(" else 1 for x in s]
if sum(s) != n // 2:
    print("No")
    return

count = 0
for i in range(n):
    if s[i] == 0:
        count += 1
    else:
        count -= 1
    if count <= -2:
        print("No")
        return
print("Yes")


def solve():
	n = int(input())
	s = input()
	op = 0
	cl = 0
	stack = []
	for i in s:
		op += int(i=='(')
		cl += int(i==')')
		if len(stack)==0:
			stack.append(i)
		elif stack[-1]=='(' and i==')':
			stack.pop()
		else:
			stack.append(i)

	if(len(stack)<=2 and op==cl):
		print("Yes")
		return
	print("No")


solve()

import sys
input = sys.stdin.readline
 
def getInt(): return int(input())
def getVars(): return list(map(int, input().split()))
def getList(): return list(map(int, input().split()))
def getStr(): return input().strip()
## -------------------------------

def addDictList(d, key, val):
    if key not in d: d[key] = []
    d[key].append(val)

def addDictInt(d, key, val):
    if key not in d: d[key] = 0
    d[key] = val
    
def addDictCount(d, key):
    if key not in d: d[key] = 0
    d[key] += 1

def addDictSum(d, key, val):
    if key not in d: d[key] = 0
    d[key] += val

## -------------------------------

n = getInt()
s = getStr()
if n %2 == 1:
    r = 'No'
else:
    r = 'Yes'
    num = 0
    for i in range(n):
        if s[i] == '(':
            num+=1
        else:
            num-=1
            if num <-1:
                r = 'No'
                break
    if num != 0:
        r = 'No'
print(r)


n = int(input())
seq = list(input())

stack = 0
minstack = 0

for i in seq:
    if i == "(":
        stack += 1
    else:
        stack -= 1
    if stack < minstack:
        minstack = stack

if stack == 0 and minstack >= -1:
    print("Yes")
else:
    print("No")

"""
NTC here
"""
from sys import setcheckinterval, stdin
setcheckinterval(1000)
 
# print("Case #{}: {} {}".format(i, n + m, n * m))
 
 
def iin(): return int(stdin.readline())
 
 
def lin(): return list(map(int, stdin.readline().split()))

n=iin()
s=list(input())
ch1=s.count('(')
if ch1==n-ch1:
    a=[]
    for i in range(n):
        if a:
            if s[i]==')' and a[-1]=='(':
                a.pop()
            else:
                a.append(s[i])
        else:
            a.append(s[i])
    if len(a)==2 or not a :
        print('Yes')
        return
print('No')



n = int(input())
s = str(input())


op = 0
cl = 0

b = 0

for c in s:
    if c == '(':
        op += 1
    if c == ')':
        if op > 0:
            op -= 1
        else:
            b += 1




if (b == 1 and op == 1) or (b == 0 and op == 0):
    print('Yes')
else:
    print('No')


n=int(input())
s=input()

lc=0
rc=0
l=0
r=0
ch=1

for i in range(len(s)):
    if(s[i]==')'):
        l+=1
        lc+=1
    else:
        r+=1
        rc+=1
        
    if(l-r>=2):
        ch=0
        
if(ch==1 and lc==rc):
    print("Yes")
else:
    print("No")
    


n = int(input())
s = input()

count = 0
res = ""
for i in s:
    if i == "(":
        count += 1
    else:
        count -= 1

    if count < -1:
        res = "No"
        break

if res == "":
    if count == 0:
        res = "Yes"
    else:
        res = "No"

print(res)