#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int y, b, r, x, i, sum, maxx = INT_MIN;
  cin >> y >> b >> r;
  for (i = y; i >= 0; i--) {
    if (i + 1 <= b && i + 2 <= r) {
      sum = 3 * i + 3;
      if (maxx < sum) {
        maxx = sum;
        break;
      }
    }
  }
  cout << maxx << endl;
  return 0;
}
