// Slower C++ solution:
#include <cstdio>

#include <queue>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;

int vis[110][110][110];

struct node

{

	int a,b,c,s;

	node (int aa,int bb,int cc,int ss):a(aa),b(bb),c(cc),s(ss){}

};

int bfs(int a,int b,int c)

{

	queue<node>q;

	q.push(node(a,b,c,0));

	while(!q.empty())

	{

		node t=q.front();

		q.pop();

		if(t.a==t.b&&t.b==t.c)

			return t.s;

		int x,y,z;

		x=t.a+2;y=t.b;z=t.c;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b+2;z=t.c;	

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b;z=t.c+2;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}	

		x=t.a+1;y=t.b+1;z=t.c;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b+1;z=t.c+1;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a+1;y=t.b;z=t.c+1;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}		

	}

	return -1;

}

int main()

{

	int x,y,z,ans;

	cin>>x>>y>>z;

	memset(vis,0,sizeof(vis));

	vis[x][y][z]=1;

	ans=bfs(x,y,z);

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.53208059481534x):
/*

                                ^....0

                               ^ .1 ^1^

                               ..     01

                              1.^     1.0

                             ^ 1  ^    ^0.1

                             1 ^        ^..^

                             0.           ^ 0^

                             .0            1 .^

                             .1             ^0 .........001^

                             .1               1. .111100....01^

                             00             ^   11^        ^1. .1^

                             1.^                              ^0  0^

                               .^                                 ^0..1

                               .1                                   1..^

                             1 .0                                     ^  ^

                            ^ 00.                                     ^^0.^

                             1 ^ 0                                     ^^110.^

                           0.   0 ^                                    ^^^10.01

                   ^^     010^   1 1                                   ^^^1110.1

                   0001  10 0   ^ 1.1                                   ^^^1111110

                   0^ 10 . 01   ^^  ^^                                   ^^^1111^1.^           ^^^

                   10  10^ 0^                                             ^^111^^^0.1^       1....^

                    11     0                                               ^^11^^^ 0..  ....1^   ^ ^

                    1.     0^                                               ^11^^^ ^ 1 111^     ^ 0.

                   10   00 11                                               ^^^^^   1 0           1.

                   0^  ^0  ^0                                                ^^^^    0            0.

                   0^  1.0  .^                                               ^^^^    1 1          .0

                   ^.^  ^^  0^                             ^1                ^^^^     0.         ^.1

                   1 ^      11                             1.                ^^^     ^ ^        ..^

                  ^..^      ^1                             ^.^               ^^^       .0       ^.0

                  0..^      ^0                              01               ^^^       ..      0..^

                 1 ..        .1                             ^.^              ^^^       1 ^  ^0001

                ^  1.        00                              0.             ^^^        ^.0 ^.1

                . 0^.        ^.^                             ^.^            ^^^         ..0.0

               1 .^^.         .^                  1001        ^^            ^^^         . 1^

               . ^ ^.         11                0.    1         ^           ^^          0.

                0  ^.          0              ^0       1                   ^^^          0.

              0.^  1.          0^             0       .1                   ^^^          ..

              .1   1.          00            .        .1                  ^^^           ..

             1      1.         ^.           0         .^                  ^^            ..

             0.     1.          .^          .         0                                  .

             .1     1.          01          .        .                                 ^ 0

            ^.^     00          ^0          1.       ^                                 1 1

            .0      00           .            ^^^^^^                                   .

            .^      00           01                                                    ..

           1.       00           10                                                   1 ^

          ^.1       00           ^.                                            ^^^    .1

          ..        00            .1                                        1..01    ..

         1.1         00           1.                                       ..^      10

        ^ 1^         00           ^.1                                      0 1      1

        .1           00            00                                       ^  1   ^

         .           00            ^.^                                        10^  ^^

       1.1           00             00                                              10^

       ..^           1.             ^.                                               1.

      0 1            ^.              00                 00                            .^

        ^            ^.              ^ 1                00   ^0000^     ^               01

     1 0             ^.               00.0^              ^00000   1.00.1              11

     . 1              0               1^^0.01                      ^^^                01

      .^              ^                1   1^^                                       ^.^

    1 1                                                                              0.

    ..                                                                              1 ^

     1                                                                               1

   ^ ^                                                                             .0

   1                                                                             ^ 1

   ..                                                          1.1            ^0.0

  ^ 0                                                           1..01^^100000..0^

  1 1                                                            ^ 1 ^^1111^ ^^

  0 ^                                                             ^ 1      1000^

  .1                                                               ^.^     .   00

  ..                                                                1.1    0.   0

  1.                                                                  .    1.   .^

  1.                                                                 1    1.   ^0

 ^ .                                                                 ^.1 00    01

 ^.0                                                                  001.     .^

 */

#include <bits/stdc++.h>

#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <set>

#include <queue>

const int maxn = 2e5 + 7;

typedef long long ll;

using namespace std;

const ll mod = 998244353;

const long double pi = 3.1415926535897932384626433832795;

priority_queue<int,vector<int>,greater<int> >q;

int a[maxn][28];

char s[maxn];

int ans[28];

int main(){

    int t; 

    int a[50];

    scanf("%d %d %d",&a[0],&a[1],&a[2]);

    sort(a,a+3);

    int ans = min(a[2]-a[0],a[2]-a[1]);

    a[0] += (a[2]-a[1]);

    ans += (a[2]-a[0])/2;

    if ((a[2] - a[0]) % 2 != 0)

        ans += 2;

    cout << ans << endl;

    return 0;

}