#include <bits/stdc++.h>
using namespace std;
int y, b, r;
int main() {
  scanf("%d %d %d", &y, &b, &r);
  for (int i = y; i >= 1; i--) {
    int yp = i;
    int bp = i + 1;
    int rp = i + 2;
    if (yp <= y && rp <= r && bp <= b) {
      printf("%d", bp + rp + yp);
      return 0;
    }
  }
}
