#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z;
  cin >> x >> y >> z;
  int d = min(min(x, y), z);
  if (x == d) {
    if (d == y && d == z)
      cout << d + d + d - 3 << endl;
    else if (d < y && d == z)
      cout << d + d + d - 3 << endl;
    else if (d == y && d < z)
      cout << d + d + d << endl;
    else if (d < y && d + 1 == z)
      cout << d + d + d << endl;
    else
      cout << d + d + d + 3 << endl;
  } else if (y == d) {
    if (d == x && d == z)
      cout << d + d + d - 3 << endl;
    else if (d < x && d == z)
      cout << d + d + d - 3 << endl;
    else
      cout << d + d + d << endl;
  } else
    cout << d + d + d - 3 << endl;
}
