#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (T e : v) {
    os << e << ' ';
  }
  return os;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int y, b, r;
  cin >> y >> b >> r;
  int best = min(y, min(b - 1, r - 2));
  cout << 3 * best + 3 << endl;
  return 0;
}
