#include <bits/stdc++.h>
int func(int a, int b) {
  int low;
  if (a > b)
    low = b;
  else
    low = a;
  return low;
}
int main() {
  int y, b, r, t;
  int temp1, temp2;
  scanf("%d %d %d", &y, &b, &r);
  temp1 = func(y, b);
  temp2 = func(temp1, r);
  if (temp2 == r) t = 3 * r - 3;
  if (temp2 == b) t = 3 * b;
  if (temp2 == y) {
    if (r - y >= 2) t = (y + 1) * 3;
    if (r - y == 1) t = (r - 1) * 3;
  }
  if (temp2 == b) t = 3 * b;
  if (temp2 == r) t = 3 * r - 3;
  printf("%d\n", t);
  return 0;
}
