#include<stdio.h>
int main()
{
	int a,b,c,max,min;
	scanf("%d %d %d",&a,&b,&c);
		max=a;
		min=a;
		if(b>max)
			max=b;
		if(b<min)
			min=b;
		if(c>max)
			max=c;
		if(c<min)
			min=c;
	scanf("%d %d %d",&max,&a+b+c-max-min,&min);
	int x,y,t=0,p=0;
	x=(a+b+c-max-min)-max;
	y=(a+b+c-max-min)-min;
	while(x!=y)
	{
		if(y%2==0)
			y=y-2;
			t++;
		if(y%2!=0)
			y=y-1;
	}
	while(x!=0)
	{
		x=x-1;
		p++;
	}
	printf("%d\n",t+p);
	return 0;
}