#include <bits/stdc++.h>
int main() {
  int y, b, r, fy, fb, fr, sum;
  scanf("%d %d %d", &y, &b, &r);
  if (y >= 1 && b >= 2 && r >= 3) {
    if (y <= 100 && b <= 100 && r <= 100) {
      fr = r;
      if (b >= (r - 1)) {
        fb = r - 1;
      } else {
        fr = b + 1;
        fb = b;
      }
      if (y >= (fb - 1)) {
        fy = fb - 1;
      } else {
        fb = y + 1;
        fy = y;
        fb = fy + 1;
        fr = fb + 1;
      }
      sum = fy + fb + fr;
      printf("%d ", sum);
    }
  }
  return 0;
}
