#include <bits/stdc++.h>
using namespace std;
int a, b, c;
void input() {
  int i, j;
  scanf("%d %d %d", &a, &b, &c);
}
void solve() {
  int x = min(a, min(b - 1, c - 2));
  printf("%d", x + x + 1 + x + 2);
  puts("");
}
int main() {
  input();
  solve();
}
