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