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: EASY

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


b = int(input())
g = int(input())
n = int(input())
minoys = max(0, n - g)
maxoys = min(b, n)
print(maxoys - minoys + 1)


(male, female, total) = (int(input()), int(input()), int(input()))
count = 0
for i in range(total + 1):
	if male - i >= 0 and female - (total - i) >= 0:
		count += 1
print(count)


if 1:
	(b, g, n) = (int(input()), int(input()), int(input()))
	l = []
	if b >= n and g >= n:
		print(n + 1)
	else:
		for i in range(n + 1):
			l.append([i, n - i])
		c = 0
		for i in range(n + 1):
			if l[i][0] + l[i][1] == n and l[i][0] <= b and (l[i][1] <= g):
				c += 1
		print(c)


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


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


def main():
	b = int(input())
	g = int(input())
	n = int(input())
	owo = 0
	for x in range(n + 1):
		if n - x <= g and x <= b:
			owo += 1
	print(owo)
main()


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

def sol():
	global ans
	for i in range(0, n + 1):
		for j in range(0, n + 1):
			if i + j == n:
				if i <= b and j <= g:
					ans += 1
	return
sol()
print(ans)


b = int(input())
g = int(input())
n = int(input())
print(min(min(b, g) - (n - min(max(b, g), n)), min(max(b, g), n)) + 1)


b = int(input())
g = int(input())
n = int(input())
soma = 0
a = 1
for i in range(n + 1):
	(x, y) = (i, n - i)
	if y <= b and x <= g:
		soma = soma + 1
print(soma)


b = int(input())
g = int(input())
n = int(input())
ans = None
if b >= n and g >= n:
	ans = n + 1
if b >= n and g < n:
	ans = g + 1
if b < n and g >= n:
	ans = b + 1
if b < n and g < n:
	ans = abs(n - g - b) + 1
print(ans)


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
b = int(input())
g = int(input())
n = int(input())
print(min(g, n) - (n - min(b, n)) + 1)


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


b = int(input())
g = int(input())
n = int(input())
if n > b and n > g:
	x = b + g - n
	print(x + 1)
else:
	print(min(b, g, n) + 1)


b = int(input()) + 1
g = int(input()) + 1
n = int(input())
r = 0
for i in range(b):
	for j in range(g):
		if n == i + j:
			r += 1
print(r)


ML = lambda : map(int, input().split())
I = lambda : input()
b = int(I())
g = int(I())
n = int(I())
print(min(b, n) + min(g, n) - n + 1)


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
b = iinput()
g = iinput()
n = iinput()
print(min(g, n) + 1 - (n - min(b, n)))


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


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return 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
b = getInt()
g = getInt()
n = getInt()
print(n + 1 - max(0, n - b) - max(0, n - g))


from sys import stdin
b = int(stdin.readline().strip())
g = int(stdin.readline().strip())
n = int(stdin.readline().strip())
st = set()
ans = 0
for i in range(b + 1):
	for j in range(g + 1):
		if j + i == n:
			ans += 1
print(ans)


b = int(input())
g = int(input())
n = int(input())
s = n + 1
m = 0
if n > g:
	m = n - g
if n > b:
	m += n - b
print(s - m)


m = int(input())
w = int(input())
b = int(input())
count = 0
for i in range(m + 1):
	for j in range(w + 1):
		if i + j == b:
			count += 1
print(count)


import sys
input = sys.stdin.readline
b = int(input())
g = int(input())
n = int(input())
a = set()
for i in range(n):
	if i <= b and n - i <= g:
		a.add((i, n - i))
	if i <= g and n - i <= b:
		a.add((n - i, i))
print(len(a))


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)
solveb()


b = int(input())
g = int(input())
n = int(input())
j = n
ma = max(b, g)
mi = min(b, g)
counter = 0
if ma >= n:
	for i in range(n + 1):
		if i <= mi:
			counter += 1
		else:
			break
else:
	counter = mi - (n - ma) + 1
print(counter)


b = int(input())
g = int(input())
n = int(input())
deck = []
cnt = 0
for i in range(n + 1):
	deck.append([i, n - i])
for x in deck:
	a1 = x[0]
	b1 = x[1]
	if a1 <= b and b1 <= g:
		cnt += 1
print(cnt)


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


b = int(input())
g = int(input())
n = int(input())
a = min(g, n) - (n - min(b, n)) + 1
print(a)


b = int(input())
g = int(input())
n = int(input())
i = 0
ans = 0
while i <= n:
	if i <= b and n - i <= g:
		ans += 1
	i += 1
print(ans)


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


b = int(input())
g = int(input())
n = int(input())
a = []
for i in range(n + 1):
	a.append([i, n - i])
c = 0
for i in range(len(a)):
	if b < a[i][0] or g < a[i][1]:
		c += 1
print(len(a) - c)


b = int(input())
g = int(input())
n = int(input())
l = []
q = []
V = 0
for i in range(0, n + 1):
	if i <= b and n - i <= g:
		V += 1
print(V)


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(n + 1 - (n - g))
elif g >= n and b < n:
	print(n + 1 - (n - b))
elif g < n and b < n:
	print(n + 1 - (n - b) - (n - g))


b = int(input())
g = int(input())
n = int(input())
max_g = min(n, g)
max_b = min(n, b)
left = [n - max_g, max_g]
right = [max_b, n - max_b]
print(abs(left[0] - right[0]) + 1)


(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 = int(input())
r = int(input())
n = int(input())
print(n + 1 - max(0, n - r) - max(0, n - b))


b = int(input())
g = int(input())
n = int(input())
(a, b) = (min(b, g), max(b, g))
total = 0
for x in range(a + 1):
	if x + b >= n:
		total += 1
print(min(n + 1, total))


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


b = int(input())
g = int(input())
n = int(input())
x = n - min(b, n)
y = min(g, n)
print(y - x + 1)


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


b = int(input())
g = int(input())
n = int(input())
count = 0
if g > b:
	(g, b) = (b, g)
for k in range(b, -1, -1):
	if -1 < n - k <= g:
		count += 1
print(count)


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


b = int(input())
g = int(input())
n = int(input())
b = min(b, n)
g = min(g, n)
op = 0
for i in range(b + 1):
	for j in range(g + 1):
		if i + j == n:
			op += 1
print(op)


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	d = get_int()
	e = get_int()
	best = float('inf')
	while n >= 0:
		best = min(best, n % d)
		n -= 5 * e
	return best

def solve_b():
	b = get_int()
	g = get_int()
	n = get_int()
	return min(b, n) - max(0, n - g) + 1
print(solve_b())


(b, g, n) = (int(input()), int(input()), int(input()))
if n == g + b:
	k = 1
else:
	k = n + 1 - int(b < n) * (n - b) - int(g < n) * (n - g)
print(k)


b = int(input())
g = int(input())
n = int(input())
i = -1
j = -1
i = n - g
j = b
if j > n:
	j = n
if n - g < 0:
	i = 0
print(j - i + 1)


b = int(input())
g = int(input())
n = int(input())
ans = 0
for ib in range(b + 1):
	rg = n - ib
	if 0 <= rg <= g:
		ans += 1
print(ans)


import sys
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def print_array(a):
	print(' '.join(map(str, a)))

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


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans
b = int(input())
g = int(input())
n = int(input())
m = n - min(g, n)
tc = min(b, n)
print(tc - m + 1)


b = int(input())
g = int(input())
n = int(input())
if min(b, g, n) == n:
	print(n + 1)
elif max(b, g, n) == n:
	print(abs(n - g - b) + 1)
else:
	x = min(b, g)
	print(x + 1)


b = int(input())
g = int(input())
n = int(input())
q = 0
if n < g:
	q += 1
if n < b:
	q += 1
if q == 2:
	print(n + 1)
elif q == 1:
	print(min(b, g) + 1)
else:
	print(abs(n - b - g) + 1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	b = int(input())
	g = int(input())
	n = int(input())
	ans = 0
	for i in range(n + 1):
		blue = i
		red = n - i
		if blue <= b and red <= g:
			ans += 1
	print(ans)


b = int(input())
g = int(input())
n = int(input())
max_boys = min(n, b)
max_girls = min(n, g)
count = 0
if n == 0:
	print(0)
	exit()
for i in range(n + 1):
	badge = [i, n - i]
	if badge[0] <= max_boys and badge[1] <= max_girls:
		count += 1
print(count)


b = int(input())
g = int(input())
n = int(input())
max_ = n + 1
if min(b, g) + 1 < max_:
	max_ = min(b, g) + 1
if b + g - n + 1 < max_:
	max_ = b + g - n + 1
print(max_)


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


b = int(input())
g = int(input())
n = int(input())
count = 0
i = 0
ty = 0
f = min(n, g)
x = n - min(n, b)
print(f - x + 1)


boys = int(input())
girls = int(input())
n = int(input())
c = 0
for i in range(n + 1):
	if i <= boys and n - i <= girls:
		c += 1
print(c)


b = int(input())
g = int(input())
n = int(input())
b = 0 if n < b else b - n
g = 0 if n < g else g - n
res = n + 1 + b + g
print(res)


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)


b = int(input())
g = int(input())
n = int(input())
decs = [(i, n - i) for i in range(n + 1)]
for i in range(len(decs)):
	if decs[i][0] > b or decs[i][1] > g:
		decs[i] = None
print(len([i for i in decs if i != None]))


b = int(input())
g = int(input())
n = int(input())
m = min(b, g)
M = max(b, g)
o = min(n + 1, m + 1)
q = min(n - M, m)
if b >= n and g >= n:
	print(n + 1)
elif M >= n:
	print(o)
else:
	print(m - q + 1)


b = int(input())
g = int(input())
n = int(input())
bw = b // 2
gw = g // 2
total_decks = n + 1
count = 0
j = 0
ans = min(g, n) - (n - min(b, n)) + 1
print(ans)


b = int(input())
g = int(input())
n = int(input())
q = set()
for i in range(n):
	if n - i <= b and n - (n - i) <= g:
		q.add((n - i, i))
	if n - i <= g and n - (n - i) <= b:
		q.add((i, n - i))
print(len(q))


b = int(input())
g = int(input())
n = int(input())
k = 0
for i in range(n + 1):
	a1 = i
	a2 = n - i
	if b >= a1 and g >= a2:
		k += 1
print(k)


b = int(input())
g = int(input())
n = int(input())
nums = []
count = 0
for i in range(n + 1):
	nums.append((i, n - i))
for j in range(len(nums)):
	a = nums[j][0]
	c = nums[j][1]
	if a <= b and c <= g:
		count = count + 1
print(count)


def f(l):
	(b, g, n) = l
	return min(n, b) + min(n, g) - n + 1
l = [int(input()) for _ in range(3)]
print(f(l))


b = int(input(''))
g = int(input(''))
n = int(input(''))
if b < n:
	d = b
else:
	d = n
count = 0
for i in range(0, d + 1):
	if n - i <= g:
		count += 1
print(count)


b = int(input())
g = int(input())
n = int(input())
min_boys = n - g if n - g > -1 else 0
max_boys = n if b >= n else b
min_girls = n - b if n - b > -1 else 0
max_girls = n if g >= n else g
print(max(max_boys - min_boys + 1, max_girls - min_girls + 1))


b = int(input())
g = int(input())
n = int(input())
ma = max(b, g)
mi = min(b, g)
if ma >= n:
	counter = min(mi, n) + 1
else:
	counter = mi - (n - ma) + 1
print(counter)


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


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
msi = lambda : map(int, stdin.readline().split())
lsi = lambda : list(msi())
(b, g, n) = (ii(), ii(), ii())
l = min(n, b)
u = min(n, g)
if n - l <= u:
	print(u + l - n + 1)
else:
	print(l + u + 2)


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


b = int(input())
g = int(input())
n = int(input())
total = 0
for x in range(0, n + 1):
	aux = n - x
	if x <= b and aux <= g:
		total = total + 1
print(total)


import sys

def rint():
	return map(int, sys.stdin.readline().split())
b = int(input())
g = int(input())
n = int(input())
cnt = 0
g_visit = set()
for bb in range(0, b + 1):
	if n - bb <= g and n - bb >= 0:
		cnt += 1
		g_visit.add(n - bb)
for gg in range(0, g + 1):
	if gg in g_visit:
		continue
	if n - gg <= b and n - gg >= 0:
		cnt += 1
print(cnt)


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


n = int(input())
d = int(input())
e = int(input())
if n >= e:
	if d >= e:
		print(e + 1)
	else:
		print(d + 1)
elif d >= e:
	print(n + 1)
else:
	print(e + 1 - (e - d + e - n))


b = int(input())
g = int(input())
n = int(input())
s = 0
for i in range(1, b + 1):
	for k in range(1, g + 1):
		if i + k == n + 1:
			s = s + 1
print(s + 1)


a = int(input())
b = int(input())
c = int(input())
count = 0
j = c
for i in range(0, c + 1):
	if i <= a and j <= b:
		count += 1
	j -= 1
print(count)


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)


import math
tc = 1
for _ in range(tc):
	b = int(input())
	g = int(input())
	n = int(input())
	c = 0
	z = [[int(i), n - int(i)] for i in range(n + 1)]
	for i in z:
		if i[0] + i[1] <= n and i[0] <= b and (i[1] <= g):
			c += 1
	print(c)


b = []
for i in range(3):
	b.append(int(input()))
if b[0] + b[1] == b[2]:
	print(1)
else:
	print(min(b[0], b[1], b[2], b[0] + b[1] - b[2]) + 1)


import itertools as it
b = int(input())
g = int(input())
n = int(input())
count = 0
for i in it.product([x for x in range(b + 1)], [x for x in range(g + 1)]):
	if i[0] + i[1] == n:
		count += 1
print(count)


b = int(input())
g = int(input())
n = int(input())
s = set()
for x in range(b + 1):
	for y in range(g + 1):
		if x + y == n:
			s.add((x, y))
print(len(s))


b = int(input())
g = int(input())
n = int(input())
cnt = 0
for i in range(b + 1):
	for j in range(g + 1):
		if i + j != n:
			continue
		cnt += 1
print(cnt)


(b, g, p) = [int(input()) for _ in range(3)]
print(len([(i, p - i) for i in range(p + 1) if i <= b and p - i <= g]))


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)


a = int(input())
b = int(input())
c = int(input())
if a < c and b < c:
	print(min(min(a, b), c) + 1 - (c - max(a, b)))
else:
	print(min(min(a, b), c) + 1)


import math

class Read:

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	b = Read.int()
	g = Read.int()
	n = Read.int()
	if b + g == n:
		print(1)
	elif b < n and g < n:
		print(b + g + 1 - n)
	else:
		print(min(n, g, b) + 1)
query_count = 1
for j in range(query_count):
	solve()


from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def A():
	(n, d, e) = IR(3)
	e *= 5
	ans = n
	m = n // e
	for i in range(m + 1):
		ans = min(ans, n - d * (n // d))
		n -= e
	print(ans)
	return

def B():
	(b, g, n) = IR(3)
	(b, g) = (min(b, g), max(b, g))
	if n <= b:
		print(n + 1)
	elif n <= g:
		print(b + 1)
	else:
		print(abs(n - b - g) + 1)
	return

def C():
	return

def D():
	return

def E():
	return

def F():
	return

def G():
	return

def H():
	return
B()


import sys
import math
input = sys.stdin.readline
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 b < n and g >= n:
	print(b + 1)
else:
	x = n - min(b, g)
	y = max(b, g)
	print(abs(x - y) + 1)


b = int(input())
g = int(input())
n = int(input())
arr = []
answer = n + 1
i = 0
j = n
for k in range(n + 1):
	arr.append((i, j))
	i += 1
	j -= 1
for i in range(len(arr)):
	if b < arr[i][0] or g < arr[i][1]:
		answer -= 1
print(answer)


m = int(input())
g = int(input())
n = int(input())
temp = 0
for i in range(n + 1):
	if m >= 0 + i and g >= n - i:
		temp += 1
print(temp)


boys = int(input())
girls = int(input())
n = int(input())

def CalculateNumberDecks():
	min_blues = 0
	min_reds = 0
	decks = 0
	i = -1
	while 1:
		i += 1
		if i <= n:
			if n - i > girls or i > boys:
				continue
			min_blues += i
			min_reds += n - i
			decks += 1
		else:
			break
	print(decks)
CalculateNumberDecks()


boys = int(input())
girls = int(input())
part = int(input())
count = 0
for i in range(part + 1):
	if i <= boys and part - i <= girls:
		count = count + 1
print(count)


def main():
	(b, g, n) = (int(input()), int(input()), int(input()))
	ans = 0
	for i in range(n + 1):
		pg = i
		pb = n - i
		if pg <= g and pb <= b:
			ans += 1
	print(ans)
main()


k = input
a = int(k())
b = int(k())
c = int(k())
print(sum((i + j == c for i in range(a + 1) for j in range(b + 1))))


n = int(input())
m = int(input())
k = int(input())
c = 0
for i in range(n + 1):
	for j in range(m + 1):
		if i + j == k:
			c += 1
print(c)


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


b = int(input())
g = int(input())
n = int(input())
ans = 0
if n == b + g:
	ans = 1
elif max(b, g) < n:
	ans = b + g - n + 1
else:
	ans = min(b, g, n) + 1
print(ans)


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())
if n <= b and n <= g:
	print(n + 1)
else:
	if n > b and n <= g:
		diff = n - b
	elif n > g and n <= b:
		diff = n - g
	else:
		diff = n - g + n - b
	print(n + 1 - diff)


a = int(input())
b = int(input())
c = int(input())
if min(a, b, c) == c:
	print(c + 1)
else:
	print(min(b, c) - c + min(a, c) + 1)


a = int(input())
b = int(input())
n = int(input())
m = max(0, n - b)
M = min(a, n)
print(M - m + 1)


boys = int(input())
girls = int(input())
decklength = int(input())
ans = 1 + min(decklength, girls)
if boys < decklength:
	ans -= decklength - boys
print(ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	b = int(inp())
	g = int(inp())
	n = int(inp())
	ans = 0
	for i in range(n + 1):
		x = i
		y = n - i
		if x <= b and y <= g:
			ans += 1
	print(ans)
testcase(1)


b = int(input())
g = int(input())
l = sorted([b, g])
b = l[0]
g = l[1]
n = int(input())
ans = 0
for i in range(n + 1):
	a = i
	e = n - i
	if a <= b and e <= g:
		ans += 1
print(ans)


a = int(input())
b = int(input())
c = int(input())
if a > b:
	(a, b) = (b, a)
count = 0
for x in range(a, -1, -1):
	if c - x <= b and c - x >= 0:
		count += 1
print(count)


from itertools import permutations
b = int(input())
g = int(input())
n = int(input())
count = 0
for i in range(b + 1):
	for j in range(g + 1):
		if i + j == n:
			count = count + 1
print(count)


b = int(input())
g = int(input())
n = int(input())
count = 0
for num in range(0, n + 1):
	t1 = num
	t2 = n - num
	if b - t1 >= 0 and g - t2 >= 0:
		count = count + 1
print(count)


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)


b = int(input())
g = int(input())
n = int(input())
decks = n + 1
if b < n:
	decks -= n - b
if g < n:
	decks -= n - g
print(decks)


b = int(input())
g = int(input())
n = int(input())
arr = []
for i in range(n + 1):
	arr.append([i, n - i])
count = 0
for i in arr:
	if i[0] < 0 or i[0] > b or i[1] < 0 or (i[1] > g):
		pass
	else:
		count += 1
print(count)


a = int(input())
b = int(input())
c = int(input())
print(min(a, b, c, a + b - c) + 1)


from sys import stdin

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
r = ii()
d = ii()
e = ii()
p = min(r, d, e) + 1
if e > max(r, d):
	p = r + d + 1 - e
print(p)


B = int(input())
G = int(input())
N = int(input())
bg = min(B, G)
if N <= bg:
	print(N + 1)
else:
	a = 0
	if max(B, G) < N:
		a += N - max(B, G)
	print(bg + 1 - a)


import math
b = int(input())
g = int(input())
n = int(input())
k = n + 1
if b > n:
	k -= 0
else:
	k -= n - b
if g > n:
	k -= 0
else:
	k -= n - g
print(k)


b = int(input())
g = int(input())
n = int(input())
if n <= min(b, g):
	print(n + 1)
else:
	l = n - min(b, g)
	r = min(max(b, g), n)
	print(r - l + 1)


b = int(input())
g = int(input())
n = int(input())
count = n + 1
if g < n:
	count -= n - g
if b < n:
	count -= n - b
print(count)


def read():
	b = int(input())
	g = int(input())
	n = int(input())
	return (b, g, n)

def solve(b, g, n):
	pb_max = min(b, n)
	pg_max = min(g, n)
	pg_min = n - pb_max
	return pg_max - pg_min + 1
print(solve(*read()))


def main():
	b = int(input())
	g = int(input())
	accepted = int(input())
	if b + g == accepted:
		print(1)
		return None
	if accepted > b and accepted > g:
		print(g - (accepted - b) + 1)
		return
	print(min(b, g, accepted) + 1)
main()


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


b = int(input())
g = int(input())
n = int(input())
o1 = b + g - n
o1 = min(o1, b, g, n) + 1
print(o1)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
b = int(input())
g = int(input())
n = int(input())
x = [0 for i in range(n + 1)]
for i in range(n + 1):
	if i > b or n - i > g:
		x[i] = 1
print(x.count(0))


b = int(input())
g = int(input())
n = int(input())
min_boys = max(0, n - g)
max_boys = min(b, n)
print(max_boys - min_boys + 1)


b = int(input())
g = int(input())
n = int(input())
if n <= max(b, g):
	print(min(b, g, n) + 1)
else:
	print(min(b, g) - (n - max(b, g)) + 1)


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


b = int(input())
b_l = range(0, b + 1)
g = int(input())
g_l = range(0, g + 1)
n = int(input())
k_1 = 0
if 1:
	if b + g == n:
		print(1)
		exit()
	for i in g_l:
		for j in b_l:
			if i + j > n:
				break
			elif i + j == n:
				k_1 += 1
	print(k_1)


b = int(input())
g = int(input())
n = int(input())
lista = []
for i in range(n + 1):
	lista.append([])
	lista[i].append(i)
	lista[i].append(n - i)
contador = 0
for i in range(n + 1):
	if lista[i][0] <= b and lista[i][1] <= g:
		contador += 1
print(contador)


import itertools as it

def find_min(b, g, n):
	b_s = []
	g_s = []
	min = []
	for i in range(n + 1):
		if i <= b:
			b_s.append(i)
		if i <= g:
			g_s.append(i)
	result = it.product(b_s, g_s)
	for each in result:
		if sum(each) == n:
			min.append(each)
	print(len(min))
b = int(input())
g = int(input())
n = int(input())
find_min(b, g, n)


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 = int(input())
g = int(input())
n = int(input())
p = min(n, g)
q = n - min(b, n)
print(p - q + 1)


b = int(input())
g = int(input())
n = int(input())
c = 0
for i in range(0, b + 1):
	if i > n:
		break
	for j in range(n - i, g + 1):
		if i + j == n:
			c += 1
		if i + j > n:
			break
print(c)


i = lambda : int(input())
b = i()
g = i()
n = i()
a = max(0, n - g)
b = max(0, n - b)
print(n + 1 - a - b)


b = int(input())
g = int(input())
n = int(input())
a = n + 1
for i in range(n + 1):
	bb = i
	gg = n - i
	if gg > g or bb > b:
		a -= 1
print(a)


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())
minb = max(0, n - g)
rb = b - minb
ming = max(0, n - b)
rg = g - ming
print(1 + min([rg, rb, n]))


b = int(input())
g = int(input())
n = int(input())
if b < n or g < n:
	r = min(b, g, b + g - n) + 1
else:
	r = min(b, g, n) + 1
print(r)


boys = int(input())
girls = int(input())
no_of_participants = int(input())
badges = []
for i in range(0, no_of_participants + 2):
	for j in range(0, no_of_participants + 2):
		if i <= boys:
			if j <= girls:
				if i + j == no_of_participants:
					badges.append([i, j])
print(len(badges))


b = int(input())
g = int(input())
n = int(input())
m = n - min(g, n)
M = min(b, n)
print(M - m + 1)


b = int(input())
g = int(input())
n = int(input())
if n < b and n < g or (n == b and n == g):
	print(n + 1)
elif n > b and n > g:
	if b == g:
		if n == 2 * b:
			print(1)
		else:
			print(n + 1 - 2 * (n - max(b, g)))
	else:
		print(max(b, g) - n + min(b, g) + 1)
else:
	print(n + 1 - (n - min(b, g)))


import math
import sys
from collections import defaultdict
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	b = ri()
	g = ri()
	n = ri()
	ans = 0
	for i in range(b + 1):
		g1 = n - i
		if 0 <= g1 <= g:
			ans += 1
	print(ans)
main()


b = int(input())
g = int(input())
n = int(input())
c = min(g, n) - (n - min(b, n)) + 1
print(c)


try:
	import math
	b = int(input())
	g = int(input())
	n = int(input())
	k = []
	a1 = n - min(b, n)
	a2 = min(g, n)
	for i in range(0, n + 1):
		k.append([i, n - i])
	k.sort(key=lambda k: k[1])
	p = []
	for i in range(0, len(k)):
		p.append(k[i][1])
	op1 = p.index(a1)
	op2 = p.index(a2)
	print(op2 - op1 + 1)
except:
	pass


b = int(input())
g = int(input())
n = int(input())
decks = []
for i in range(n + 1):
	decks.append((i, n - i))
count = 0
flag = 1 if min(b, g) == 1 else 0
for idx in decks:
	if flag == 1:
		if idx[0] <= b and idx[1] <= g:
			count += 1
	elif idx[1] <= g and idx[0] <= b:
		count += 1
print(count)


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
if debug:
	test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	b = inp()
	g = inp()
	n = inp()
	ans = 0
	for i in range(0, n + 1):
		if i <= b and n - i <= g:
			ans += 1
	print(ans)


b = int(input())
g = int(input())
n = int(input())
m = n + 1
if n - g > 0:
	if n - b > 0:
		m -= 2 * n - g - b
	else:
		m -= n - g
elif n - b > 0:
	m -= n - b
print(m)


b = int(input())
g = int(input())
n = int(input())
ans = 0
for x in range(b + 1):
	y = n - x
	if g >= y >= 0:
		ans += 1
print(ans)


[b, g, n] = [int(input()) for _ in range(3)]
print(min(g, n) - (n - min(b, n)) + 1)


b = int(input())
g = int(input())
n = int(input())
l = [b, g, n]
if n > b and n > g:
	count = 0
	m = max(b, g)
	for i in range(m, 0, -1):
		if n - i <= min(b, g):
			count += 1
		else:
			break
	print(count)
elif n == b + g:
	print(1)
else:
	print(min(l) + 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)


n = int(input())
m = int(input())
o = int(input())
c = 0
for i in range(o + 1):
	if i <= n and o - i <= m:
		c += 1
print(c)


I0 = lambda : map(int, input().split())
I1 = lambda : int(input())
I2 = lambda : list(map(int, input().split()))
b = I1()
g = I1()
n = I1()
f = False
start = 0
end = n
res = 0
while end != -1:
	if start <= b and end <= g:
		res += 1
	start += 1
	end -= 1
print(res)


(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))


n = int(input())
w = int(input())
q = int(input())
m = q - min(n, q)
mi = min(q, w)
ans = mi - m + 1
print(ans)


from __future__ import print_function, division, unicode_literals
__metaclass__ = type
try:
	input = raw_input
	range = xrange
except NameError:
	pass
import sys

def solve(B: int, G: int, N: int) -> int:
	return min(N, B) - max(N - G, 0) + 1

def main() -> None:
	(B, G, N) = (int(input()) for _ in range(3))
	print(solve(B, G, N))
main()


import bisect

def do():
	(b, g, n) = (int(input()), int(input()), int(input()))
	nums = []
	for i in range(n + 1):
		nums.append([i, n - i])
	ob = [min(b, n), n - min(b, n)]
	og = [n - min(g, n), min(g, n)]
	l = nums.index(ob)
	r = nums.index(og)
	return abs(l - r) + 1
print(do())


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())
max_boys = min(b, n)
max_girls = min(g, n)
min_boys = n - max_girls
min_girls = n - max_boys
num_of_combs = max_boys - min_boys + 1
print(num_of_combs)


b = int(input())
g = int(input())
n = int(input())
mx = min(n, b)
mn = max(0, n - g)
ans = mx - mn + 1
print(ans)


b = int(input())
g = int(input())
n = int(input())
bn = list(range(n + 1))
gn = list(reversed(list(range(n + 1))))
res = 0
for i in range(n + 1):
	if bn[i] > b:
		continue
	if gn[i] > g:
		continue
	res += 1
print(res)


b = int(input())
g = int(input())
n = int(input())
if n <= g and n <= b:
	print(n + 1)
elif n <= g and n > b:
	print(b + 1)
elif n > g and n <= b:
	print(g + 1)
else:
	b1 = min(b, g)
	g1 = max(b, g)
	c = 0
	for i in range(b1, -1, -1):
		if n - i <= g1:
			c = c + 1
	print(c)


b = int(input())
g = int(input())
n = int(input())
a = [i for i in range(n + 1)]
tot = 0
for i in a:
	if i > b or n - i > g:
		tot -= 1
	tot += 1
print(tot)


b = int(input())
g = int(input())
n = int(input())
v = [True for i in range(n + 1)]
if b < n:
	for i in range(b, n, 1):
		v[i] = False
if g < n:
	for i in range(n - g):
		v[i] = False
count = 0
for i in range(n + 1):
	if v[i] == True:
		count += 1
print(count)


boys = int(input())
girls = int(input())
n = int(input())
count = 0
blue = 0
red = 0
for i in range(0, n + 1):
	blue = i
	red = n - i
	if blue <= boys and red <= girls:
		count += 1
print(count)


import sys
input = sys.stdin.readline

def main():
	b = int(input())
	g = int(input())
	n = int(input())
	ans = n + 1
	for x in range(n + 1):
		y = n - x
		if x > b or y > g:
			ans -= 1
	print(ans)
main()


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


b = int(input())
g = int(input())
n = int(input())
moznosti = []
koncno_stevilo = 0
for i in range(0, n + 1):
	moznosti.append((i, n - i))
for (f, d) in moznosti:
	if f <= b:
		if d <= g:
			koncno_stevilo += 1
print(koncno_stevilo)


ara = []
for i in range(3):
	n = int(input())
	ara.append(n)
Min = min(ara[0], ara[1])
Max = max(ara[0], ara[1])
(sum, i, j) = (0, Min, ara[2] - Min)
if ara[2] < Min:
	print(ara[2] + 1)
else:
	while True:
		if i >= 0 and j <= Max:
			if i + j == ara[2]:
				sum += 1
		else:
			break
		i -= 1
		j += 1
	print(sum)


def main():
	(b, g, n) = (int(input()) for _ in 'bgn')
	print(min(min(b, n) + min(g, n) - n, n) + 1)
main()


b = int(input())
g = int(input())
c = int(input())
count = 0
for i in range(b + 1):
	for j in range(g + 1):
		if i + j == c:
			count += 1
print(count)


import sys, copy
b = int(sys.stdin.readline())
g = int(sys.stdin.readline())
n = int(sys.stdin.readline())
arr = []
for i in range(n + 1):
	arr.append((i, n - i))
ans = 0
for i in arr:
	if i[0] <= b and i[1] <= g:
		ans += 1
print(ans)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
a = ri(1)
b = ri(1)
n = ri(1)
ans = []
for i in range(a + 1):
	for j in range(b + 1):
		if i + j == n:
			ans.append((i, j))
print(len(ans))


x = int(input())
y = int(input())
z = int(input())
print(min(x + y - z, x, y, z) + 1)


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


x = '10\n2\n8'
x = '19\n10\n20'
x = '5\n6\n3'
x = '5\n3\n5'

def f(string):

	def c(x=(r for r in string.splitlines())):
		return next(x)
	return c
source = input
(b, g, n) = map(int, (source() for _ in range(3)))

def answer(n, girls, boys):
	max_minority = min(girls + boys - max(girls, boys), n)
	min_minority = max(n - max(girls, boys), 0)
	return min(n, max_minority - min_minority) + 1
print(answer(n, g, b))


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())
a = []
x = n
for i in range(n, -1, -1):
	a.append([x, n - x])
	x -= 1
ans = 0
for i in range(len(a)):
	if a[i][0] <= b and a[i][1] <= g:
		ans += 1
print(ans)


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)


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


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
b = ii()
g = ii()
n = ii()
t = min(b, g)
e = max(b, g)
r = 0
if n >= e:
	for i in range(t + 1):
		if n - i <= e:
			r += 1
else:
	r = min(n + 1, t + 1)
print(r)


from math import *
b = int(input())
g = int(input())
n = int(input())
l = max(0, n - g)
r = min(n, b)
res = r - l + 1
print(res)


b = int(input())
g = int(input())
t = int(input())
if b >= t and g >= t:
	print(t + 1)
elif b >= t and g < t:
	print(g + 1)
elif b < t and g >= t:
	print(b + 1)
elif b < t and g < t:
	if b + g == t:
		print(1)
	else:
		print(min(g, b) + 1 - (t - max(b, g)))


b = int(input())
g = int(input())
n = int(input())
ary = range(n + 1)
mi = 0
for i in range(n + 1):
	mi += ary[i] <= min(b, n) and n - ary[i] <= min(g, n)
print(mi)


b = int(input())
g = int(input())
n = int(input())
if b > n:
	b = n
if g > n:
	g = n
g = n - g
print(abs(b - g) + 1)


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


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


b = int(input())
g = int(input())
n = int(input())
if b >= n:
	minimum = 0
else:
	minimum = n - b
if g >= n:
	maximum = n
else:
	maximum = g
print(maximum - minimum + 1)


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


b = int(input())
a = int(input())
n = int(input())
if a < n and b < n:
	print(a + b - n + 1)
else:
	print(min(a, b, n) + 1)


a = int(input())
b = int(input())
c = int(input())
p = 0
for i in range(c + 1):
	x = i
	y = c - i
	if x <= a and y <= b:
		p += 1
print(p)


def main():
	b = int(input())
	g = int(input())
	n = int(input())
	b = min(b, n)
	g = min(g, n)
	ans = n + 1
	for i in range(n + 1):
		if b < i or g < n - i:
			ans -= 1
	print(ans)
	return
main()


def main():
	b = int(input())
	g = int(input())
	n = int(input())
	s1 = []
	s2 = []
	for i in range(n + 1):
		s1.append(i)
		s2.append(n - i)
	ans = 0
	for i in range(n + 1):
		bb = s1[i]
		gg = s2[i]
		if bb <= b and gg <= g:
			ans += 1
	print(ans)
main()


import math

def getint():
	return int(input())

def getlist():
	return list(map(int, input().split()))
(s, i, e) = [getint() for _ in range(3)]
print(min(s, i, e, s + i - e) + 1)


(Girl, Boy, N, Count) = (int(input()), int(input()), int(input()), 0)
for i in range(N + 1):
	Count += 1 if i <= Boy and N - i <= Girl else 0
print(Count)


(a, b, c) = [int(input()) for i in range(3)]
print(min(a + b - c, a, b, c) + 1)


b = int(input())
g = int(input())
n = int(input())
c = 0
for bi in range(0, b + 1):
	for gi in range(0, g + 1):
		if bi + gi == n:
			c += 1
print(c)


b = int(input())
g = int(input())
n = int(input())
nn = max(b, g)
ss = 0
for bb in range(0, nn + 1):
	for gg in range(0, nn + 1):
		if bb <= b and gg <= g and (bb + gg == n):
			ss += 1
print(ss)


import sys
import copy
from math import *
from collections import deque

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output2.txt', 'w')
b = int(input())
g = int(input())
n = int(input())
r = min(g, n)
bl = min(b, n)
c = 0
for i in range(n + 1):
	if i <= r and n - i <= bl:
		c += 1
print(c)


t = 1
for _ in range(t):
	b = int(input())
	g = int(input())
	n = int(input())
	if b < n and g < n:
		print(min(b, g) - n + max(b, g) + 1)
	else:
		print(min(b, g, n) + 1)


def get_num_decks(b, g, n):
	mxb = min(b, n)
	mxg = min(g, n)
	mnb = n - mxg
	mng = n - mxb
	s = set()
	for i in range(mnb, mxb + 1):
		s.add((i, n - i))
	for i in range(mng, mxg + 1):
		s.add((n - i, i))
	return len(s)
ins = []
for _ in range(3):
	ins.append(int(input()))
print(get_num_decks(*ins))


import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans
mod = int(1000000000.0) + 7

def ssinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def nninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
from collections import OrderedDict
b = iinp()
g = iinp()
n = iinp()
a = min(g, n)
b = min(b, n)
print(abs(a - (n - b)) + 1)


b = int(input())
g = int(input())
m = int(input())
c = 0
d = 0
if g < m:
	c = m - g
if b < m:
	d = m - b
m = m - c - d
print(m + 1)


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


b = int(input())
g = int(input())
n = int(input())
ans = min(b, n) - (n - min(g, n)) + 1
print(min(ans, n + 1))


b = int(input())
g = int(input())
n = int(input())
if b == 0 or g == 0:
	print(1)
elif b >= n and g >= n:
	print(n + 1)
else:
	max = b if b > g else g
	min = g if b > g else b
	if max >= n:
		print(min + 1)
	else:
		rest = n - max
		min -= rest
		print(min + 1)


import sys
input = sys.stdin.readline
from math import ceil
b = int(input())
g = int(input())
n = int(input())
b = min(b, n)
g = min(g, n)
print(b - (n - g) + 1)


ii = lambda : int(input())
(a, b, n) = (ii(), ii(), ii())
(a, b) = (min(a, n), min(b, n))
print(b - (n - a) + 1)


b = int(input())
g = int(input())
n = int(input())
i = 0
xk = n
kol = 0
while i <= n:
	if i <= b and n - i <= g:
		kol += 1
	i += 1
print(kol)


a = int(input())
b = int(input())
c = int(input())
s = c + 1
if a < c:
	s -= c - a
if b < c:
	s -= c - b
print(s)


(b, g, n) = (int(input()), int(input()), int(input()))
m = min(b, g)
ma = max(b, g)
if m >= n:
	print(n + 1)
elif ma >= n:
	print(m + 1)
else:
	print(abs(n - ma - m) + 1)


b = int(input())
g = int(input())
n = int(input())
ans = set()
for i in range(b + 1):
	if 0 <= n - i <= g:
		ans.add((i, n - i))
for i in range(g + 1):
	if 0 <= n - i <= b:
		ans.add((n - i, i))
print(len(ans))


(b, g, n) = (int(input()) for _ in range(3))
ming = max(n - b, 0)
maxg = min(n, g)
print(maxg - ming + 1)


from sys import stdin, stdout
b = int(stdin.readline().strip())
g = int(stdin.readline().strip())
n = int(stdin.readline().strip())
least = n - min(b, n)
most = min(g, n)
sol = most - least + 1
stdout.write(str(sol))


def beiges(b, g, n):
	result = 0
	for i in range(b + 1):
		result += 0 <= n - i <= g
	return result
B = int(input())
G = int(input())
N = int(input())
print(beiges(B, G, N))


b = int(input())
g = int(input())
n = int(input())
ans = 0
b = n - b if n - b > 0 else 0
g = n - g if n - g > 0 else 0
ans = n + 1 - (b + g)
print(ans)


from collections import defaultdict as dc
import sys
import math

def inp():
	p = sys.stdin.readline()
	return int(p)
p = inp()
q = inp()
n = inp()
if p + q == n:
	print(1)
else:
	l = min(p, q)
	z = max(p, q)
	if n - l > 0:
		print(min(l, z - (n - l)) + 1)
	else:
		print(n + 1)


a = int(input())
b = int(input())
c = int(input())
if a >= c and b >= c:
	print(c + 1)
elif a + b == c:
	print(1)
elif a < c and b >= c or (b < c and a >= c):
	print(min(a, b) + 1)
else:
	print(a + b - c + 1)


a = int(input())
b = int(input())
c = int(input())
x = 0
if c > a or c > b:
	if c > a:
		x += c - a
	if c > b:
		x += c - b
	print(c + 1 - x)
else:
	print(c + 1)


b = int(input())
g = int(input())
n = int(input())
ans = 0
for k in range(b + 1):
	ans += 0 <= n - k <= g
print(ans)


b = int(input())
g = int(input())
n = int(input())
if g <= n and n <= b:
	count = g + 1
elif b <= n and n <= g:
	count = b + 1
elif n >= g and n >= b:
	p = b
	q = n - b
	m = n - g
	z = p - m + 1
	count = z
else:
	count = n + 1
print(count)


def main():
	b = int(input())
	g = int(input())
	n = int(input())
	uc = 0
	for i in range(n + 1):
		bc = i
		gc = n - i
		if bc > b or gc > g:
			uc += 1
	print(n + 1 - uc)
main()


b = int(input())
g = int(input())
n = int(input())
max1 = max(b, g)
min1 = min(b, g)
x = 0
cnt = 0
for i in range(max1, -1, -1):
	x = n - i
	if x <= min1 and x >= 0:
		cnt += 1
	else:
		i -= 1
print(cnt)


b = int(input())
g = int(input())
n = int(input())
gg = n - min(n, g)
bb = min(n, b)
print(abs(bb - gg) + 1)


(b, g, n) = (int(input()), int(input()), int(input()))
(x1, y1, x2, y2) = (0, 0, 0, 0)
if n <= g:
	(x1, y1) = (0, n)
else:
	(x1, y1) = (n - g, g)
if n <= b:
	(x2, y2) = (n, 0)
else:
	(x2, y2) = (b, n - b)
print(abs(x1 - x2) + 1)


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))


import math
b = int(input())
g = int(input())
total = int(input())
first = []
second = []
i = 0

def is_right(b, g, b_badge, g_badge):
	if b_badge <= b and g_badge <= g:
		return True
	return False
count = 0
while i <= total:
	boy = i
	girl = total - i
	if is_right(b, g, boy, girl):
		count += 1
	i += 1
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]))


import sys
input = lambda : sys.stdin.readline().strip()
b = int(input())
g = int(input())
n = int(input())
print(min(min(b, g) - max(0, n - max(b, g)) + 1, n + 1))


b = int(input())
g = int(input())
n = int(input())
result = 0
for i in range(g + 1):
	for y in range(b + 1):
		if i + y == n:
			result += 1
print(result)


b = int(input())
g = int(input())
n = int(input())
x = []
for i in range(0, n + 1):
	y = []
	y.append(i)
	y.append(n - i)
	x.append(y)
j = 0
c = 0
while j < n + 1:
	if x[j][0] <= b and x[j][1] <= g:
		c += 1
	j += 1
print(c)


def solve(blue, red, deck):
	curr_red = 0
	curr_blue = deck
	deck += 1
	ans = 0
	while deck > 0:
		if curr_blue > blue:
			pass
		elif curr_red > red:
			pass
		else:
			ans += 1
		deck -= 1
		curr_red += 1
		curr_blue -= 1
	return ans
print(solve(int(input()), int(input()), int(input())))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
b = get_int()
g = get_int()
n = get_int()
if n <= b and n <= g:
	print(n + 1)
else:
	mi = min(b, g)
	mx = max(b, g)
	lower = n - mi
	upper = min(mx, n)
	print(upper - lower + 1)


(G, B, N, C) = (int(input()), int(input()), int(input()), 0)
print(sum((1 if i <= B and N - i <= G else 0 for i in range(N + 1))))


def fun(b, g, n):
	if b >= n and g >= n:
		return n + 1
	elif b < n and g >= n:
		return b + 1
	elif b >= n and g < n:
		return g + 1
	else:
		count = 0
		for i in range(n + 1):
			if i <= b and n - i <= g:
				count += 1
		return count
b = int(input())
g = int(input())
n = int(input())
print(fun(b, g, n))


import sys

def solve(b, g, n):
	bdeck = min(b, n)
	gdeck = n - min(g, n)
	return abs(gdeck - bdeck) + 1

def main():
	B = int(input())
	G = int(input())
	N = int(input())
	print(solve(B, G, N))
main()


b = int(input())
g = int(input())
n = int(input())
piles = []
for i in range(n + 1):
	piles.append([i, n - i])
if n <= b and n <= g:
	print(n + 1)
elif n <= b and n > g:
	minB = n - g
	print(n + 1 - minB)
elif n <= g and n > b:
	minG = n - b
	print(n + 1 - minG)
elif n == b + g:
	print(1)
elif n > b and n > g:
	print(abs(b - (n - g) + 1))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
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)


import math
b = int(input())
g = int(input())
n = int(input())
bn = min(b, n)
gn = min(g, n)
print(max(bn, gn) - (n - min(bn, gn)) + 1)


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


import sys
import math
import bisect

def main():
	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)
main()


b = int(input())
g = int(input())
n = int(input())
count = 0
N = n
i = 0
j = n
while i <= n:
	if i <= b and j <= g:
		count += 1
	i += 1
	j -= 1
print(count)


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


boys = int(input())
girls = int(input())
invite = int(input())
deck = []
counter = 0
for i in range(invite + 1):
	deck.append((i, invite - i))
length = len(deck)
i = 0
while i < length:
	if deck[i][0] <= boys and deck[i][1] <= girls:
		counter = counter + 1
	i = i + 1
print(counter)


b = int(input())
g = int(input())
n = int(input())
bmin = max(0, n - g)
gmin = max(0, n - b)
print(n - bmin - gmin + 1)


b = int(input())
g = int(input())
n = int(input())
min_cat = min(b, g)
max_cat = max(b, g)
min_deck = n + 1
if n >= min_cat and n <= max_cat:
	min_deck = min_cat + 1
if n > max_cat:
	min_deck = 1 + min_cat - (n - max_cat)
print(min_deck)


def sol_badges(b, g, n):
	counter = 0
	for boys in range(0, min(n + 1, b + 1)):
		for girls in range(0, min(g + 1, n + 1)):
			if boys + girls == n:
				counter += 1
	return counter
b = int(input())
g = int(input())
n = int(input())
out = sol_badges(b, g, n)
print(out)


b = int(input())
g = int(input())
n = int(input())
big = max(b, g)
small = min(b, g)
print(min(small, n) + 1 - max(0, n - big))


b = int(input())
g = int(input())
n = int(input())
f = n + 1
if b < n:
	f = f - (n - b)
if g < n:
	f = f - (n - g)
print(f)


b = int(input())
g = int(input())
n = int(input())
if n - g > 0:
	aux = n - g
else:
	aux = 0
count = 0
for i in range(0 + aux, n + 1):
	count += 1
	if i >= min(b, n):
		break
print(count)


b = int(input())
g = int(input())
n = int(input())
sol = n + 1
if b < n:
	sol -= n - b
if g < n:
	sol -= n - g
print(sol)


b = int(input())
g = int(input())
n = int(input())
b1 = min(n, g)
r1 = min(n, b)
t1 = max(r1, b1)
t2 = min(r1, b1)
print(t1 - max((n - t2, n - t1)) + 1)


(b, g, n) = (int(input()), int(input()), int(input()))
min_g = max(n - b, 0)
max_g = min(g, n)
ans = max_g - min_g + 1
print(ans)


(b, g, n) = [int(input()) for _ in range(3)]
print(max(n + 1 - (max(n - b, 0) + max(n - g, 0)), 0))


boys = int(input())
girls = int(input())
n = int(input())
decks = n + 1
deck = []
for i in range(0, n + 1):
	blue = i
	red = n - i
	if blue > boys or red > girls:
		continue
	deck.append(1)
print(len(deck))


b = int(input())
g = int(input())
n = int(input())
maxP = max(b, g)
minN = min(b, g, n)
if n > maxP:
	a = minN + 1 - (n - maxP)
	if a < 0:
		a = 0
	print(a)
else:
	print(minN + 1)


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
b = ii()
g = ii()
n = ii()
a = min(b, g, n) + 1
x = b + g - n + 1
print(min(a, x))


b = int(input())
g = int(input())
n = int(input())
print(abs(min(b, n) - (n - min(g, n))) + 1)


b = int(input())
g = int(input())
part = int(input())
qtd_b = 0
qtd_g = 0
if b >= part:
	qtd_b = part
else:
	qtd_b = b
	qtd_g = part - b
res = 0
while qtd_b <= b and qtd_b >= 0 and (qtd_g <= g) and (qtd_g >= 0):
	res += 1
	qtd_b -= 1
	qtd_g += 1
print(res)


b = int(input())
g = int(input())
n = int(input())
T = min(max(b, g), n)
tot = n - T
T2 = min(min(b, g), n)
print(T2 - tot + 1)


def fun(x, y, z):
	if x > z:
		x = z
	if y > z:
		y = z
	k = 0
	for i in range(0, x + 1):
		if z - i <= y:
			k += 1
	return k
b = int(input())
g = int(input())
n = int(input())
print(fun(b, g, n))


a = int(input())
b = int(input())
n = int(input())
if min(a, b) >= n:
	print(n + 1)
elif min(a, b) < n and max(a, b) >= n:
	print(min(a, b) + 1)
else:
	temp = min(a, b) + 1
	ans = temp - (n - max(a, b))
	print(ans)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(b,) = I()
(g,) = I()
(n,) = I()
ans = 0
for i in range(b + 1):
	for j in range(g + 1):
		if i + j == n:
			ans += 1
print(ans)


a = int(input())
b = int(input())
c = int(input())
ans = 0
ans += max(0, c - a)
ans += max(0, c - b)
print(c + 1 - ans)


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L
c = cinn()
b = c.cin()
g = c.cin()
n = c.cin()
mb = min(n, b)
mg = min(n, g)
ming = n - mb
print(mg - ming + 1)


boys = int(input())
girls = int(input())
n = int(input())
meninosNecessarios = n - girls
meninasNecessarias = n - boys
if meninasNecessarias < 0:
	meninasNecessarias = 0
if meninosNecessarios < 0:
	meninosNecessarios = 0
print(n - meninasNecessarias - meninosNecessarios + 1)


import math, sys
import heapq
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def binarySearch(arr, x):
	(l, r) = (0, len(arr) - 1)
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return True
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return False
b = ii()
g = ii()
n = ii()
count = 0
minn = min([b, g, n])
if minn == n:
	print(minn + 1)
else:
	minn = min([b, g])
	maxm = b + g - minn
	for i in range(minn + 1):
		if n - i <= maxm:
			count = count + 1
	print(count)