#include <bits/stdc++.h>
using namespace std;
int main() {
  int y, r, b, a = 1, e = 2, c = 3;
  cin >> y >> b >> r;
  while (a != y && e != b && c != r) {
    a++;
    e++;
    c++;
  }
  cout << a + e + c;
  return 0;
}
