#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class GogoXBallsAndBinsEasy { public:
	int solve(vector <int> T)
	{
		int maxMove = 0;

		vector<int> S = T;

		reverse(S.begin(), S.end());
		int dif = 0;
		for(int i=0; i<S.size(); ++i)
			dif += abs(S[i]-T[i]);
		maxMove = max(maxMove, dif/2);
/*
		sort(S.begin(), S.end());
		do {
			int dif = 0;
			for(int i=0; i<S.size(); ++i)
				dif += abs(S[i]-T[i]);
			maxMove = max(maxMove, dif/2);
		} while( next_permutation(S.begin(), S.end()) );
*/
		return maxMove;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, GogoXBallsAndBinsEasy().solve(T));}
int main(){

CASE(0)
	int T_[] = {0, 2, 5};
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = 5; 
END
CASE(1)
	int T_[] = {5, 6, 7, 8};
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = 4; 
END
CASE(2)
	int T_[] = {0, 1, 2, 10};
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = 11; 
END
CASE(3)
	int T_[] = {1, 2, 3, 4, 5, 6, 7, 8};
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = 16; 
END
/*
CASE(4)
	int T_[] = ;
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = ; 
END
CASE(5)
	int T_[] = ;
	  vector <int> T(T_, T_+sizeof(T_)/sizeof(*T_)); 
	int _ = ; 
END
*/
}
// END CUT HERE
