#include <bits/stdc++.h>
using namespace std;
int main() {
  int y, b, r;
  int numar[3];
  while (scanf("%d%d%d", &y, &b, &r) != EOF) {
    numar[0] = y;
    numar[1] = b;
    numar[2] = r;
    sort(numar, numar + 3);
    for (int i = numar[1]; i >= 0; i--) {
      if (y >= i - 1 && b >= i && r >= i + 1) {
        printf("%d\n", 3 * i);
        break;
      }
    }
  }
}
