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