There are $b$ boys and $g$ girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and $n$ participants have accepted the invitation. The organizers do not know how many boys and girls are among them.

Organizers are preparing red badges for girls and blue ones for boys.

Vasya prepared $n+1$ decks of badges. The $i$-th (where $i$ is from $0$ to $n$, inclusive) deck contains $i$ blue badges and $n-i$ red ones. The total number of badges in any deck is exactly $n$.

Determine the minimum number of decks among these $n+1$ that Vasya should take, so that there will be a suitable deck no matter how many girls and boys there will be among the participants of the tournament.


-----Input-----

The first line contains an integer $b$ ($1 \le b \le 300$), the number of boys. 

The second line contains an integer $g$ ($1 \le g \le 300$), the number of girls. 

The third line contains an integer $n$ ($1 \le n \le b + g$), the number of the board games tournament participants.


-----Output-----

Output the only integer, the minimum number of badge decks that Vasya could take.


-----Examples-----
Input
5
6
3

Output
4

Input
5
3
5

Output
4



-----Note-----

In the first example, each of 4 decks should be taken: (0 blue, 3 red), (1 blue, 2 red), (2 blue, 1 red), (3 blue, 0 red).

In the second example, 4 decks should be taken: (2 blue, 3 red), (3 blue, 2 red), (4 blue, 1 red), (5 blue, 0 red). Piles (0 blue, 5 red) and (1 blue, 4 red) can not be used.

Difficulty: competition

Starter code:

Solutions:
def main():
    import sys
    input = sys.stdin.readline
    
    b = int(input())
    g = int(input())
    n = int(input())
    
    ans = n + 1
    if b < n:
        ans -= n - b
    if g < n:
        ans -= n - g
    
    print(ans)
    
    return 0

main()


b = int(input())
g = int(input())
n = int(input())

res = 0
for i in range(n+1):
    if i <= b and (n-i) <= g: res += 1
        
print(res)

b = int(input())
g = int(input())
n = int(input())

b = min(n, b)
g = min(n, g)

mx = b
mn = 0

if g < n:
    mn = n - g

print(mx - mn + 1)


b=int(input())
g=int(input())
n=int(input())

ans=0
for i in range(n+1):
    bb=i
    gg=n-i
    if bb<=b and gg<=g:
        ans+=1

print(ans)

b = int(input())    
g = int(input())
n = int(input())
res = sum(1 for i in range(n + 1) if b >= i and g >= (n - i))
print(res)


b = int(input())
g = int(input())
n = int(input())
wyn = 0
for bb in range(b + 1):
    if n - bb in range(g + 1):
        wyn += 1
print(wyn)

b, g, n = int(input()), int(input()), int(input())

badges = set()

for i in range(n + 1):

    if i <= b and n - i <= g:
        badges.add((i, n - i))

print(len(badges))

b, g, n = [int(input()) for i in range(3)]
max_man = min(n, b)
max_girl = min(n, g)
min_man = n - max_girl
print(max(0, max_man - min_man + 1))


b = int(input())
g = int(input())
n = int(input())

x = y = 0
if n > b:
    x = n - b
if n > g:
    y = n - g

print(n+1 - x - y)

boy = int(input())
girl = int(input())
n = int(input())
cnt = 0
for i in range(0, n + 1):
    j = n - i
    if i <= boy and j <= girl:
        cnt += 1
print(cnt)

b = int(input())
g = int(input())
n = int(input())

max_boy = min(b, n)
min_boy = max(n-g, 0)
print(max_boy - min_boy + 1)

b = int(input())
g = int(input())
n = int(input())

print(max(min(b,n)-max(0,(n-g))+1,0))

import sys
input = sys.stdin.readline

b=int(input())
g=int(input())
n=int(input())

print(n+1-max(n-b,0)-max(n-g,0))


def solvea():
    n = int(input())
    d = int(input())
    e = 5 * int(input())
    best = 0
    for enr in range((n + e - 1) // e):
        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 __starting_point():
    solveb()

__starting_point()

b = int(input())
g = int(input())
n = int(input())
ans = 0
for i in range(n+1):
    if i > b:
        continue
    if n - i > g:
        continue
    ans += 1

print(ans)

b = int(input())
g = int(input())
n = int(input())
if b>=n and g>=n:
    print(n+1)
elif b>=n and g<n:
    print(g+1)
elif g>=n and b<n:
    print(b+1)
else:
    print(b+g-n+1)


b = int(input())
g = int(input())
n = int(input())

print(min([b, g, n, b + g - n]) + 1)

import sys 
from collections import defaultdict
input = lambda : sys.stdin.readline().rstrip()

b = int(input())
g = int(input())
n = int(input())

ans = 0 
for i in range(n + 1):
  if i <= b and n - i <= g:
    ans += 1

print(ans)



a = int(input())
b = int(input())
n = int(input())
m = max(0, n - b)

M = min(a, n)
print(M - m + 1)


b=int(input())
g=int(input())
n=int(input())
cnt=0
for i in range(n+1):
    if i<=b and (n-i)<=g:
        cnt += 1
print(cnt)

b = int(input())
g = int(input())
n = int(input())
if n<b and n<g:
  out = n+1
elif n<b and g==n:
  out = n+1-n+b
elif n==b and g<n:
  out = n+1-n+g
elif n<=g:
  out = n+1-n+b
elif n<=b:
  out = n+1-n+g
else:
  out = n+1-n+g-n+b
print(out)

b=int(input())
r=int(input())
n=int(input())
print(n+1-max(0,n-r)-max(0,n-b))

def badges(b,g,n):
    p = [(i,n-i) for i in range(n+1)]
    count = 0
    for i in p:
        if i[0] <= b and i[1] <= g:
            count += 1
    return count

b = int(input())
g = int(input())
n = int(input())
print(badges(b,g,n))

b=int(input())
g=int(input())
n=int(input())
l=[]
count=0
for i in range(n+1):
    x1=i
    x2=n-i
    if (x1<=b and x2<=g):
        count+=1
    else:
        continue
print(count)

def gcd(x,y):
    if(y==0):
        return x
    return gcd(y,x%y)




b = int(input())
g = int(input())
n = int(input())
mb = max(0, n - g)
mg = max(0, n - b)
mab = min(n, b)
mag = min(n, g)
cb = mab - mb
cg = mag - mg
print(min([cb+1, cg +1, n + 1]))