#include <bits/stdc++.h>
using namespace std;
int main() {
  int y, b, r;
  cin >> y >> b >> r;
  int x = r;
  if (b < x - 1) {
    x = b + 1;
  }
  if (y < x - 2) {
    x = y + 2;
  }
  cout << 3 * x - 3 << (char)0x0A;
  return 0;
}
