#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int y, b, r;
  cin >> y >> b >> r;
  int m = min({y, b, r});
  int y1, b1, r1;
  for (int i = 1; i <= m; i++) {
    y1 = i;
    b1 = y1 + 1;
    r1 = b1 + 1;
    if (y1 == y || b1 == b || r1 == r) {
      break;
    }
  }
  cout << (y1 + b1 + r1) << endl;
  return 0;
}
