#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long y, b, r;
  cin >> y >> b >> r;
  if (r <= b & r <= y) {
    cout << 3 * (r - 1);
  } else if (b <= y) {
    cout << 3 * b;
  } else if ((y + 2) <= r) {
    cout << 3 * (y + 1);
  } else {
    cout << 3 * y;
  }
  return 0;
}
