#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, n, y, b, r, mn;
  while (cin >> y >> b >> r) {
    if (y + 1 <= b && y + 2 <= r) {
      cout << y + (y + 1) + (y + 2) << endl;
    } else if (b - 1 <= y && b + 1 <= r) {
      cout << b + (b - 1) + (b + 1) << endl;
    } else if (r - 2 <= y && r - 1 <= b) {
      cout << r + (r - 1) + (r - 2) << endl;
    }
  }
  return 0;
}
