#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int32_t main(int argc, char const *argv[]) {
  int y, b, r;
  cin >> y >> b >> r;
  int key = 1;
  while (key == 1) {
    if (b < y + 1 || r < y + 2) {
      y--;
    } else {
      key = 0;
    }
  }
  cout << 3 * y + 3;
  return 0;
}
