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