#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int y, b, r;
  cin >> y >> b >> r;
  for (int i = y; i >= 1; --i) {
    if (b > i && r > i + 1) {
      cout << i + (i + 1) + (i + 2) << endl;
      return 0;
    }
  }
}
