Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! 

Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes how many times he had a breakfast, a dinner and a supper (thus, the card contains three integers). Vasiliy could sometimes have missed some meal, for example, he could have had a breakfast and a supper, but a dinner, or, probably, at some days he haven't been at the dining room at all.

Vasiliy doesn't remember what was the time of the day when he arrived to sanatorium (before breakfast, before dinner, before supper or after supper), and the time when he left it (before breakfast, before dinner, before supper or after supper). So he considers any of these options. After Vasiliy arrived to the sanatorium, he was there all the time until he left. Please note, that it's possible that Vasiliy left the sanatorium on the same day he arrived.

According to the notes in the card, help Vasiliy determine the minimum number of meals in the dining room that he could have missed. We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left.
The only line contains three integers *b*, *d* and *s* (0 ≤ *b*, *d*, *s* ≤ 10<sup class="upper-index">18</sup>,  *b* + *d* + *s* ≥ 1) — the number of breakfasts, dinners and suppers which Vasiliy had during his vacation in the sanatorium.
In the first sample, Vasiliy could have missed one supper, for example, in case he have arrived before breakfast, have been in the sanatorium for two days (including the day of arrival) and then have left after breakfast on the third day. 

In the second sample, Vasiliy could have arrived before breakfast, have had it, and immediately have left the sanatorium, not missing any meal.

In the third sample, Vasiliy could have been in the sanatorium for one day, not missing any meal.
3 2 1
1
1 0 0
0
1 1 1
0
1000000000000000000 0 1000000000000000000
999999999999999999
1000 0 0
1998
0 1 0
0
0 0 1
0
1 1 0
0
0 1 1
0
1000000000000000000 999999999999999999 999999999999999999
0
1000000000000000000 1000000000000000000 999999999999999999
0
1000000000000000000 1000000000000000000 1000000000000000000
0
999999999999999999 999999999999999999 999999999999999999
0
999999999999999999 1000000000000000000 999999999999999999
0
999999999999999999 1000000000000000000 1000000000000000000
0
999999999999999999 999999999999999998 999999999999999999
0
999999999999999999 999999999999999999 1000000000000000000
0
10 10 10
0
9 11 11
1
10 8 9
1
12 8 8
6
13 18 14
7
94 87 14
85
35 91 108
88
1671 24 419
2897
7759 10296 4966
7865
8912 10561 8205
4003
1000000100 1000000083 1000000047
68
999996782 1000007108 1000009860
15828
999342691 1000075839 1000144842
871152
951468821 1005782339 1063348170
169445178
498556507 1820523034 1566999959
1575489600
99999999999999938 99999999999999971 99999999999999944
58
99999999999995757 100000000000000116 99999999999999158
5315
100000000481729714 100000000353636209 99999999472937283
1136885934
100000330161030627 99999005090484867 99999729994406004
1925237170381
100040306518636197 100049788380618015 99377557930019414
681712312580417
117864695669097197 53280311324979856 171825292362519668
172505577730962281
64058874468711639 248004345115813505 265277488186534632
218491756788544118
0 323940200031019351 1000000000000000000
1676059799968980647
0 1000000000000000000 0
1999999999999999998
4 3 5
1
0 0 1000000000000000000
1999999999999999998
1000000000000000000 0 0
1999999999999999998
0 1000000000000000000 1000000000000000000
999999999999999999
1000000000000000000 1000000000000000000 0
999999999999999999
6436340231848 215 5328562123
12867351901356
1 4352626266226 1
8705252532448
647397084215 513125 15999899
1294777655404
429 42 132
682
1 3 1
2
0 6 0
10
100 100 99
0
3 3 2
0
10 10 9
0
3 3 1
1
100 99 100
0
5 5 4
0
50 70 80
38
4 4 4
0
4 4 3
0
1 0 1
0
0 0 2
2
1 1 10
16
5 2 3
3
5 5 1
3
10 200000 10
399978
3 0 0
4
100 100 100
0
3 5 5
1
3 4 3
0
1000000000000000000 1 0
1999999999999999997
2 0 0
2
5 6 4
1
0 2 2
1
1000000000000000000 100000000000000000 0
1899999999999999998
2 2 1
0
1000000000000000000 1 1
1999999999999999996
1 2 2
0
1 1 5
6
10 0 5
13
10 10 0
9
0 1000 0
1998
b,d,s = map(int,input().split(" "))
min3 = min(b,d,s)
max3 = max(b,d,s)
mid3 = b+d+s-min3-max3
l = 0
if (max3 == d):
    if (b<max3-1):
        l+=(max3-1-b)
    if (d<max3-1):
        l+=(max3-1-d)
elif (max3 == b):
    if (s<max3-1):
        l+=(max3-1-s)
    if (d<max3-1):
        l+=(max3-1-d)
else:
    if (b<max3-1):
        l+=(max3-1-b)
    if (d<max3-1):
        l+=(max3-1-d)
print(l)
# b - d - s
# x   x   -
# x   x   x
# x   x   

# s - b - d
#     x   -
# x   x   x
# -   x   x
# d - s - b
