#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int ans1, ans2, ans3;
int main() {
  scanf("%d%d%d", &a, &b, &c);
  for (int i = 1; i <= a; ++i) {
    if ((i + 1) <= b && (i + 2) <= c) {
      ans1 = i;
      ans2 = i + 1;
      ans3 = i + 2;
    }
  }
  cout << ans1 + ans2 + ans3 << endl;
  return 0;
}
