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