#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  while (c >= 3) {
    if (c - 1 <= b && c - 2 <= a) {
      cout << 3 * c - 3 << '\n';
      break;
    } else {
      c--;
    }
  }
  return 0;
}
