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