#include <bits/stdc++.h>
using namespace std;
int main() {
  int y, b, r;
  cin >> y >> b >> r;
  int x = min(y, min(b - 1, r - 2));
  if (x == y) {
    cout << 3 * (y + 1);
    return 0;
  } else if (x == b - 1) {
    cout << 3 * (b);
    return 0;
  } else {
    cout << 3 * (r - 1);
    return 0;
  }
  return 0;
}
