n=int(input())
a=int(input())
b=int(input())
c=int(input())
if not 1<=n<=200000:
    print('кате')
elif not 1<=a<=n and not 1<=b<=n and not 1<=c<=n:
    print('кате')
else:
    if a>b>c:
        print(0)
        print(n-a)
    elif b>a>c:
        print(0)
        print(n-b)
    elif c>a>b:
        print(0)
        print(n-c)
    elif a==b==c:
        print(0)
        print(0)
