#include <bits/stdc++.h>
using namespace std;
int arr[1000];
int main() {
  int a, b, c;
  for (int i = 0; i < 3; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i >= 0; i--) {
    if (arr[i] < arr[i + 1]) {
      arr[i + 1] = arr[i] + 1;
      arr[i + 2] = arr[i + 1] + 1;
    } else if (arr[i] >= arr[i + 1])
      arr[i] = arr[i + 1] - 1;
  }
  cout << arr[0] + arr[1] + arr[2] << endl;
  return 0;
}
