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