#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
int main() {
  int y = read(), b = read(), r = read();
  int ans = min(r - 2, min(b - 1, y));
  cout << ans + ans + 1 + ans + 2;
  return 0;
}
