def func(n): while 1: if A[2] >= 3 and A[1] >= 1: A[2] -= 2 A[0] += 1 A.sort() n = makeNeck(n) elif A[2] >= 5: A[0] -= 4 A[1] += 1 A[0] += 1 A.sort() n = makeNeck(n) else: break return n def makeNeck(n): A[0] -= 1 A[1] -= 1 A[2] -= 1 return n+1 A = list(map(int,input().split())) A.sort() ans = min(A) if ans > 0: A[0] -= ans A[1] -= ans A[2] -= ans else: print(0) exit() ans = makeNeck(ans) print(func(ans)-1)