#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long y, b, r;
  cin >> y >> b >> r;
  long long y1 = b - 1, y2 = r - 2;
  cout << 3 * min(y, min(y1, y2)) + 3 << '\n';
}
