#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  c -= 2;
  b -= 1;
  int ans = min({a, b, c});
  if (ans < 0) {
    cout << 0;
  } else {
    ans = ans * 3 + 3;
    cout << ans;
  }
  return 0;
}
