#include <bits/stdc++.h>   using namespace std;   void solve() {     int y, b, r;     cin >> y >> b >> r;     while (1) {       if (r - 1 <= b && r - 2 <= y) {         break;       }       --r;     }     cout << 3 * r - 3;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }   