#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[3];
  cin >> arr[0] >> arr[1] >> arr[2];
  arr[0] += 2;
  arr[1] += 1;
  sort(arr, arr + 3);
  int n = 3 * arr[0];
  cout << n - 3 << endl;
  return 0;
}
