#include <bits/stdc++.h>
int main() {
  int r, b, y, i, sum;
  scanf("%d %d %d", &y, &b, &r);
  sum = y + b + r;
  y = y - 1;
  r = r - 3;
  b = b - 2;
  for (i = 6; i <= sum; i += 3) {
    if (y == 0 || r == 0 || b == 0) {
      break;
    } else {
      y = y - 1;
      r = r - 1;
      b = b - 1;
    }
  }
  printf("%d", i);
}
