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