// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

inline int toInt(string s) { int v; istringstream in(s); in >> v; return v; }
template<class T> inline string toString(T x) { ostringstream out; out << x; return out.str(); }

template<class T> inline T sqr(T x) { return x * x; }
const int INF = (1 << 25);
const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0, sizeof(a))

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a)  (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n)  FOR(i, 0, n)

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int f[101][101][101];

int main() {
    int a, b, c;

    REP(i, 101) REP(j, 101) REP(k, 101) f[i][j][k] = INF;

    scanf("%d %d %d", &a, &b, &c);

    f[a][b][c] = 0;

    FOR(i, a, 101) FOR(j, b, 101) FOR(k, c, 101) {
        if (i + 2 < 101) f[i + 2][j][k] = min(f[i][j][k] + 1, f[i + 2][j][k]);
        if (j + 2 < 101) f[i][j + 2][k] = min(f[i][j][k] + 1, f[i][j + 2][k]);
        if (k + 2 < 101) f[i][j][k + 2] = min(f[i][j][k] + 1, f[i][j][k + 2]);
        if (i + 1 < 101 && j + 1 < 101) f[i + 1][j + 1][k] = min(f[i][j][k] + 1, f[i + 1][j + 1][k]);
        if (i + 1 < 101 && k + 1 < 101) f[i + 1][j][k + 1] = min(f[i][j][k] + 1, f[i + 1][j][k + 1]);
        if (j + 1 < 101 && k + 1 < 101) f[i][j + 1][k + 1] = min(f[i][j][k] + 1, f[i][j + 1][k + 1]);
    }

    int res = INF;
    REP(i, 101) {
        if (res > f[i][i][i]) res = f[i][i][i];
    }

    printf("%d\n", res);

    return 0;
}


Measured memory_bytes: 4224