#include <bits/stdc++.h>
int y, b, r, x;
template <typename T>
inline void read(T &var) {
  T x = 0;
  int w = 0;
  char ch = 0;
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  var = w ? -x : x;
}
inline int min(int a, int b) { return a < b ? a : b; }
int main(int argc, char const *argv[]) {
  read(y), read(b), read(r);
  y += 2, b += 1;
  x = min(y, min(b, r));
  printf("%d\n", 3 * x - 3);
  return 0;
}
