#include<bits/stdc++.h>
using namespace std;
int main(){
  int arr[4],sum=0;
  for(int i=0;i<3;i++){
    cin>>arr[i];
    int x=arr[i];
    if(x==1) sum+=6;
    else if(x==2) sum+=5;
    else if(x==3) sum+=4;
    else if(x==4) sum+=3;
    else if(x==5) sum+=2;
    else if(x==6) sum+=1;
  }
  cout<<sum;
  return 0;
}
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
    int sum=0;
  cin>>a>>b>>c;
  sum=(7-a)+(7-b)+(7-c);

cout<<sum<<endl;
return 0;
}