#include <bits/stdc++.h>
using namespace std;
int main() {
  int y, b, r, i = 1, j = 2, k = 3;
  cin >> y >> b >> r;
  while (true) {
    if (i + 1 > y || j + 1 > b || k + 1 > r) break;
    i++, j++, k++;
  }
  cout << i + j + k << endl;
  return 0;
}
