#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &x, T2 y) {
  if (y < x) x = y;
};
template <typename T1, typename T2>
inline void chkmax(T1 &x, T2 y) {
  if (y > x) x = y;
};
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int mx = 2e9;
  int a, b, c;
  cin >> a >> b >> c;
  chkmin(mx, a);
  chkmin(mx, b - 1);
  chkmin(mx, c - 2);
  cout << 3 * mx + 3;
  return 0;
}
