#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, b, y;
  cin >> y >> b >> r;
  int u = min(r, min(b, y)) - 4;
  while (u < y && u + 1 < b && u + 2 < r) u++;
  cout << 3 * u + 3;
  return 0;
}
