#include <bits/stdc++.h>
class solution {
 private:
  int y, b, r;
  int ans;
  int min(int a, int b) {
    if (a < b) return a;
    return b;
  }

 public:
  solution() {
    scanf("%d %d %d", &y, &b, &r);
    ans = min(min(y, r - 2), (y, b - 1));
    printf("%d\n", ans < 0 ? 0 : 3 * (ans + 1));
  }
};
int main() {
  solution();
  return 0;
}
