
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
bool fun(ll mid, int k, vector<int>&v){
    int count=0;
       while(count<mid){
           sort(v.begin(),v.end(),greater<int>());
           for(int i=0;i<k;i++)
           {
               if(v[i]==0){
                   return false;
               }
               else{
                   v[i]--;
               }
           }
           count++;
       }
       return true;
}
int main()
{
    vector<int>v1={3,3,3};
    
    int n=v1.size();
    int k=2;
    
    int l=0;
    ll h=n*(*max_element(v1.begin(),v1.end()));
    ll ans=0;
    while(l<=h){
          ll mid=l+(h-l)/2;
          vector<int>v=v1;
          if(fun(mid,k,v)){
              ans=mid;
              l=mid+1;
          }
          else{
              h=mid-1;
          }
            }
    cout<<ans<<endl;
    return 0;
}