#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int main() {
  int p, q, r;
  scanf("%d %d %d", &p, &q, &r);
  int i = 1;
  while (i <= p && i + 1 <= q && i + 2 <= r) i++;
  printf("%d\n", 3 * i);
  return 0;
}
