#include <bits/stdc++.h>
using namespace std;
struct XX {
  long long a;
  long long b;
};
class xxGreater {
 public:
  bool operator()(const XX& riLeft, const XX& riRight) const {
    if ((riLeft.a) == (riRight.a)) {
      return riLeft.b > riRight.b;
    }
    return (riLeft.a) < (riRight.a);
  }
};
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int y, b, r;
  cin >> y >> b >> r;
  int ans = 0;
  int prev = 0;
  if (y + 1 <= b) {
    ans = y + y + 1;
    prev = y + 1;
  } else {
    ans = (b - 1) + b;
    prev = b;
  }
  if (prev + 1 <= r) {
    ans += prev + 1;
  } else {
    ans = (r - 2) + (r - 1) + r;
  }
  cout << ans << endl;
  return 0;
}
