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