#include <bits/stdc++.h>
using namespace std;
int tt;
#pragma GCC optimize("O1")
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const int N = 200003;
const int M = 1000000;
const long long mod = 1000000007;
const int mod1 = (1 << 16);
const int mod2 = (1 << 30);
int y, r, b, i, j, ans;
void solve() {
  cin >> y >> b >> r;
  for (i = 1; i <= y; i++) {
    if (i + 1 <= b && i + 2 <= r) ans = i;
  }
  cout << ans + ans + ans + 3 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (tt = 1; tt <= t; tt++) {
    solve();
  }
}
