#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, e, f, g = 0, h, i, j, l, m, n, o, q, p, r, s, t, u, v,
                              w, x, y, z;
  cin >> a >> b >> c;
  d = min(b - 1, c - 2);
  cout << min(a, d) * 3 + 3;
}
