#include <bits/stdc++.h>
using namespace std;
const int oo = 2e9;
const int Nmax = 1e5 + 5;
int b, r, y;
int main() {
  cin >> y >> b >> r;
  int maxim = 0;
  for (int i = 1; i <= y; i++)
    for (int j = 1; j <= b; j++)
      for (int k = 1; k <= r; k++)
        if (i + 1 == j && j + 1 == k) maxim = max(maxim, i + j + k);
  cout << maxim;
  return 0;
}
