#include <bits/stdc++.h>
using namespace std;
int main() {
  long long y, b, r, rn, bn, sum = 0;
  cin >> y >> b >> r;
  while (y > 0) {
    rn = y + 2;
    bn = y + 1;
    if (rn <= r && bn <= b) {
      sum = rn + bn + y;
      break;
    }
    y--;
  }
  if (sum == 0) {
    return 0;
  }
  cout << sum;
  return 0;
}
