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