#include <bits/stdc++.h>
using namespace std;
const int MAX = 300005;
int main() {
  long long t, n, k, mn, mx, f, cnt1, cnt2, ans, i, x, y, j, x1, x2, x3, b, r;
  cin >> y >> b >> r;
  for (i = 1; i <= y; i++) {
    for (j = 1; j <= b; j++) {
      for (k = 1; k <= r; k++) {
        if (((k - i) == 2) && ((j - i) == 1)) {
          x1 = i;
          x2 = j;
          x3 = k;
        }
      }
    }
  }
  cout << (x1 + x2 + x3) << endl;
  return 0;
}
