#include <bits/stdc++.h>
using namespace std;
const int N = 100005, M = 1000005;
const long long MOD = 1e9 + 7;
const double eps = 1e-9;
int main() {
  int y, b, r;
  scanf("%d%d%d", &y, &b, &r);
  for (int i = y; i >= 1; i--) {
    if (b >= i + 1 && r >= i + 2) {
      printf("%d\n", i + i + 1 + i + 2);
      return 0;
    }
  }
  return 0;
}
