#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b, c;
  cin >> a >> b >> c;
  for (long long i = a; i >= 1; i--) {
    if (i + 1 <= b and i + 2 <= c) {
      a = i;
      break;
    }
  }
  cout << 3 * a + 3 << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long testcases = 1;
  while (testcases--) {
    solve();
  }
  return 0;
}
