#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int b2 = b - 1, c2 = c - 2;
  int max = a;
  if (b2 < max) {
    max = b2;
  }
  if (c2 < max) {
    max = c2;
  }
  cout << ((max + 1) * 3) << endl;
}
