#include <bits/stdc++.h>
int main() {
  int y, b, r, n = 1;
  scanf("%d%d%d", &y, &b, &r);
  while (n != 0) {
    if (r - 1 > b)
      r = r - 1;
    else
      break;
  }
  while (n != 0) {
    if (r - 2 > y)
      r = r - 1;
    else
      break;
  }
  printf("%d\n", (r + r - 1 + r - 2));
  return 0;
}
