const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};
const bigInt=function(undefined){"use strict";var BASE=1e7,LOG_BASE=7,MAX_INT=9007199254740992,MAX_INT_ARR=smallToArray(MAX_INT),DEFAULT_ALPHABET="0123456789abcdefghijklmnopqrstuvwxyz";var supportsNativeBigInt=typeof BigInt==="function";function Integer(v,radix?,alphabet?,caseSensitive?){if(typeof v==="undefined")return Integer[0];if(typeof radix!=="undefined")return+radix===10&&!alphabet?parseValue(v):parseBase(v,radix,alphabet,caseSensitive);return parseValue(v)}function BigInteger(value,sign){this.value=value;this.sign=sign;this.isSmall=false}BigInteger.prototype=Object.create(Integer.prototype);function SmallInteger(value){this.value=value;this.sign=value<0;this.isSmall=true}SmallInteger.prototype=Object.create(Integer.prototype);function NativeBigInt(value){this.value=value}NativeBigInt.prototype=Object.create(Integer.prototype);function isPrecise(n){return-MAX_INT<n&&n<MAX_INT}function smallToArray(n){if(n<1e7)return[n];if(n<1e14)return[n%1e7,Math.floor(n/1e7)];return[n%1e7,Math.floor(n/1e7)%1e7,Math.floor(n/1e14)]}function arrayToSmall(arr){trim(arr);var length=arr.length;if(length<4&&compareAbs(arr,MAX_INT_ARR)<0){switch(length){case 0:return 0;case 1:return arr[0];case 2:return arr[0]+arr[1]*BASE;default:return arr[0]+(arr[1]+arr[2]*BASE)*BASE}}return arr}function trim(v){var i=v.length;while(v[--i]===0);v.length=i+1}function createArray(length){var x=new Array(length);var i=-1;while(++i<length){x[i]=0}return x}function truncate(n){if(n>0)return Math.floor(n);return Math.ceil(n)}function add(a,b){var l_a=a.length,l_b=b.length,r=new Array(l_a),carry=0,base=BASE,sum,i;for(i=0;i<l_b;i++){sum=a[i]+b[i]+carry;carry=sum>=base?1:0;r[i]=sum-carry*base}while(i<l_a){sum=a[i]+carry;carry=sum===base?1:0;r[i++]=sum-carry*base}if(carry>0)r.push(carry);return r}function addAny(a,b){if(a.length>=b.length)return add(a,b);return add(b,a)}function addSmall(a,carry){var l=a.length,r=new Array(l),base=BASE,sum,i;for(i=0;i<l;i++){sum=a[i]-base+carry;carry=Math.floor(sum/base);r[i]=sum-carry*base;carry+=1}while(carry>0){r[i++]=carry%base;carry=Math.floor(carry/base)}return r}BigInteger.prototype.add=function(v){var n=parseValue(v);if(this.sign!==n.sign){return this.subtract(n.negate())}var a=this.value,b=n.value;if(n.isSmall){return new BigInteger(addSmall(a,Math.abs(b)),this.sign)}return new BigInteger(addAny(a,b),this.sign)};BigInteger.prototype.plus=BigInteger.prototype.add;SmallInteger.prototype.add=function(v){var n=parseValue(v);var a=this.value;if(a<0!==n.sign){return this.subtract(n.negate())}var b=n.value;if(n.isSmall){if(isPrecise(a+b))return new SmallInteger(a+b);b=smallToArray(Math.abs(b))}return new BigInteger(addSmall(b,Math.abs(a)),a<0)};SmallInteger.prototype.plus=SmallInteger.prototype.add;NativeBigInt.prototype.add=function(v){return new NativeBigInt(this.value+parseValue(v).value)};NativeBigInt.prototype.plus=NativeBigInt.prototype.add;function subtract(a,b){var a_l=a.length,b_l=b.length,r=new Array(a_l),borrow=0,base=BASE,i,difference;for(i=0;i<b_l;i++){difference=a[i]-borrow-b[i];if(difference<0){difference+=base;borrow=1}else borrow=0;r[i]=difference}for(i=b_l;i<a_l;i++){difference=a[i]-borrow;if(difference<0)difference+=base;else{r[i++]=difference;break}r[i]=difference}for(;i<a_l;i++){r[i]=a[i]}trim(r);return r}function subtractAny(a,b,sign){var value;if(compareAbs(a,b)>=0){value=subtract(a,b)}else{value=subtract(b,a);sign=!sign}value=arrayToSmall(value);if(typeof value==="number"){if(sign)value=-value;return new SmallInteger(value)}return new BigInteger(value,sign)}function subtractSmall(a,b,sign){var l=a.length,r:any=new Array(l),carry=-b,base=BASE,i,difference;for(i=0;i<l;i++){difference=a[i]+carry;carry=Math.floor(difference/base);difference%=base;r[i]=difference<0?difference+base:difference}r=arrayToSmall(r);if(typeof r==="number"){if(sign)r=-r;return new SmallInteger(r)}return new BigInteger(r,sign)}BigInteger.prototype.subtract=function(v){var n=parseValue(v);if(this.sign!==n.sign){return this.add(n.negate())}var a=this.value,b=n.value;if(n.isSmall)return subtractSmall(a,Math.abs(b),this.sign);return subtractAny(a,b,this.sign)};BigInteger.prototype.minus=BigInteger.prototype.subtract;SmallInteger.prototype.subtract=function(v){var n=parseValue(v);var a=this.value;if(a<0!==n.sign){return this.add(n.negate())}var b=n.value;if(n.isSmall){return new SmallInteger(a-b)}return subtractSmall(b,Math.abs(a),a>=0)};SmallInteger.prototype.minus=SmallInteger.prototype.subtract;NativeBigInt.prototype.subtract=function(v){return new NativeBigInt(this.value-parseValue(v).value)};NativeBigInt.prototype.minus=NativeBigInt.prototype.subtract;BigInteger.prototype.negate=function(){return new BigInteger(this.value,!this.sign)};SmallInteger.prototype.negate=function(){var sign=this.sign;var small=new SmallInteger(-this.value);small.sign=!sign;return small};NativeBigInt.prototype.negate=function(){return new NativeBigInt(-this.value)};BigInteger.prototype.abs=function(){return new BigInteger(this.value,false)};SmallInteger.prototype.abs=function(){return new SmallInteger(Math.abs(this.value))};NativeBigInt.prototype.abs=function(){return new NativeBigInt(this.value>=0?this.value:-this.value)};function multiplyLong(a,b){var a_l=a.length,b_l=b.length,l=a_l+b_l,r=createArray(l),base=BASE,product,carry,i,a_i,b_j;for(i=0;i<a_l;++i){a_i=a[i];for(var j=0;j<b_l;++j){b_j=b[j];product=a_i*b_j+r[i+j];carry=Math.floor(product/base);r[i+j]=product-carry*base;r[i+j+1]+=carry}}trim(r);return r}function multiplySmall(a,b){var l=a.length,r=new Array(l),base=BASE,carry=0,product,i;for(i=0;i<l;i++){product=a[i]*b+carry;carry=Math.floor(product/base);r[i]=product-carry*base}while(carry>0){r[i++]=carry%base;carry=Math.floor(carry/base)}return r}function shiftLeft(x,n){var r=[];while(n-- >0)r.push(0);return r.concat(x)}function multiplyKaratsuba(x,y){var n=Math.max(x.length,y.length);if(n<=30)return multiplyLong(x,y);n=Math.ceil(n/2);var b=x.slice(n),a=x.slice(0,n),d=y.slice(n),c=y.slice(0,n);var ac=multiplyKaratsuba(a,c),bd=multiplyKaratsuba(b,d),abcd=multiplyKaratsuba(addAny(a,b),addAny(c,d));var product=addAny(addAny(ac,shiftLeft(subtract(subtract(abcd,ac),bd),n)),shiftLeft(bd,2*n));trim(product);return product}function useKaratsuba(l1,l2){return-.012*l1-.012*l2+15e-6*l1*l2>0}BigInteger.prototype.multiply=function(v){var n=parseValue(v),a=this.value,b=n.value,sign=this.sign!==n.sign,abs;if(n.isSmall){if(b===0)return Integer[0];if(b===1)return this;if(b===-1)return this.negate();abs=Math.abs(b);if(abs<BASE){return new BigInteger(multiplySmall(a,abs),sign)}b=smallToArray(abs)}if(useKaratsuba(a.length,b.length))return new BigInteger(multiplyKaratsuba(a,b),sign);return new BigInteger(multiplyLong(a,b),sign)};BigInteger.prototype.times=BigInteger.prototype.multiply;function multiplySmallAndArray(a,b,sign){if(a<BASE){return new BigInteger(multiplySmall(b,a),sign)}return new BigInteger(multiplyLong(b,smallToArray(a)),sign)}SmallInteger.prototype._multiplyBySmall=function(a){if(isPrecise(a.value*this.value)){return new SmallInteger(a.value*this.value)}return multiplySmallAndArray(Math.abs(a.value),smallToArray(Math.abs(this.value)),this.sign!==a.sign)};BigInteger.prototype._multiplyBySmall=function(a){if(a.value===0)return Integer[0];if(a.value===1)return this;if(a.value===-1)return this.negate();return multiplySmallAndArray(Math.abs(a.value),this.value,this.sign!==a.sign)};SmallInteger.prototype.multiply=function(v){return parseValue(v)._multiplyBySmall(this)};SmallInteger.prototype.times=SmallInteger.prototype.multiply;NativeBigInt.prototype.multiply=function(v){return new NativeBigInt(this.value*parseValue(v).value)};NativeBigInt.prototype.times=NativeBigInt.prototype.multiply;function square(a){var l=a.length,r=createArray(l+l),base=BASE,product,carry,i,a_i,a_j;for(i=0;i<l;i++){a_i=a[i];carry=0-a_i*a_i;for(var j=i;j<l;j++){a_j=a[j];product=2*(a_i*a_j)+r[i+j]+carry;carry=Math.floor(product/base);r[i+j]=product-carry*base}r[i+l]=carry}trim(r);return r}BigInteger.prototype.square=function(){return new BigInteger(square(this.value),false)};SmallInteger.prototype.square=function(){var value=this.value*this.value;if(isPrecise(value))return new SmallInteger(value);return new BigInteger(square(smallToArray(Math.abs(this.value))),false)};NativeBigInt.prototype.square=function(v){return new NativeBigInt(this.value*this.value)};function divMod1(a,b){var a_l=a.length,b_l=b.length,base=BASE,result=createArray(b.length),divisorMostSignificantDigit=b[b_l-1],lambda=Math.ceil(base/(2*divisorMostSignificantDigit)),remainder:any=multiplySmall(a,lambda),divisor=multiplySmall(b,lambda),quotientDigit,shift,carry,borrow,i,l,q;if(remainder.length<=a_l)remainder.push(0);divisor.push(0);divisorMostSignificantDigit=divisor[b_l-1];for(shift=a_l-b_l;shift>=0;shift--){quotientDigit=base-1;if(remainder[shift+b_l]!==divisorMostSignificantDigit){quotientDigit=Math.floor((remainder[shift+b_l]*base+remainder[shift+b_l-1])/divisorMostSignificantDigit)}carry=0;borrow=0;l=divisor.length;for(i=0;i<l;i++){carry+=quotientDigit*divisor[i];q=Math.floor(carry/base);borrow+=remainder[shift+i]-(carry-q*base);carry=q;if(borrow<0){remainder[shift+i]=borrow+base;borrow=-1}else{remainder[shift+i]=borrow;borrow=0}}while(borrow!==0){quotientDigit-=1;carry=0;for(i=0;i<l;i++){carry+=remainder[shift+i]-base+divisor[i];if(carry<0){remainder[shift+i]=carry+base;carry=0}else{remainder[shift+i]=carry;carry=1}}borrow+=carry}result[shift]=quotientDigit}remainder=divModSmall(remainder,lambda)[0];return[arrayToSmall(result),arrayToSmall(remainder)]}function divMod2(a,b){var a_l=a.length,b_l=b.length,result=[],part=[],base=BASE,guess,xlen,highx,highy,check;while(a_l){part.unshift(a[--a_l]);trim(part);if(compareAbs(part,b)<0){result.push(0);continue}xlen=part.length;highx=part[xlen-1]*base+part[xlen-2];highy=b[b_l-1]*base+b[b_l-2];if(xlen>b_l){highx=(highx+1)*base}guess=Math.ceil(highx/highy);do{check=multiplySmall(b,guess);if(compareAbs(check,part)<=0)break;guess--}while(guess);result.push(guess);part=subtract(part,check)}result.reverse();return[arrayToSmall(result),arrayToSmall(part)]}function divModSmall(value,lambda){var length=value.length,quotient=createArray(length),base=BASE,i,q,remainder,divisor;remainder=0;for(i=length-1;i>=0;--i){divisor=remainder*base+value[i];q=truncate(divisor/lambda);remainder=divisor-q*lambda;quotient[i]=q|0}return[quotient,remainder|0]}function divModAny(self,v){var value,n=parseValue(v);if(supportsNativeBigInt){return[new NativeBigInt(self.value/n.value),new NativeBigInt(self.value%n.value)]}var a=self.value,b=n.value;var quotient;if(b===0)throw new Error("Cannot divide by zero");if(self.isSmall){if(n.isSmall){return[new SmallInteger(truncate(a/b)),new SmallInteger(a%b)]}return[Integer[0],self]}if(n.isSmall){if(b===1)return[self,Integer[0]];if(b==-1)return[self.negate(),Integer[0]];var abs=Math.abs(b);if(abs<BASE){value=divModSmall(a,abs);quotient=arrayToSmall(value[0]);var remainder=value[1];if(self.sign)remainder=-remainder;if(typeof quotient==="number"){if(self.sign!==n.sign)quotient=-quotient;return[new SmallInteger(quotient),new SmallInteger(remainder)]}return[new BigInteger(quotient,self.sign!==n.sign),new SmallInteger(remainder)]}b=smallToArray(abs)}var comparison=compareAbs(a,b);if(comparison===-1)return[Integer[0],self];if(comparison===0)return[Integer[self.sign===n.sign?1:-1],Integer[0]];if(a.length+b.length<=200)value=divMod1(a,b);else value=divMod2(a,b);quotient=value[0];var qSign=self.sign!==n.sign,mod=value[1],mSign=self.sign;if(typeof quotient==="number"){if(qSign)quotient=-quotient;quotient=new SmallInteger(quotient)}else quotient=new BigInteger(quotient,qSign);if(typeof mod==="number"){if(mSign)mod=-mod;mod=new SmallInteger(mod)}else mod=new BigInteger(mod,mSign);return[quotient,mod]}BigInteger.prototype.divmod=function(v){var result=divModAny(this,v);return{quotient:result[0],remainder:result[1]}};NativeBigInt.prototype.divmod=SmallInteger.prototype.divmod=BigInteger.prototype.divmod;BigInteger.prototype.divide=function(v){return divModAny(this,v)[0]};NativeBigInt.prototype.over=NativeBigInt.prototype.divide=function(v){return new NativeBigInt(this.value/parseValue(v).value)};SmallInteger.prototype.over=SmallInteger.prototype.divide=BigInteger.prototype.over=BigInteger.prototype.divide;BigInteger.prototype.mod=function(v){return divModAny(this,v)[1]};NativeBigInt.prototype.mod=NativeBigInt.prototype.remainder=function(v){return new NativeBigInt(this.value%parseValue(v).value)};SmallInteger.prototype.remainder=SmallInteger.prototype.mod=BigInteger.prototype.remainder=BigInteger.prototype.mod;BigInteger.prototype.pow=function(v){var n=parseValue(v),a=this.value,b:any=n.value,value,x,y;if(b===0)return Integer[1];if(a===0)return Integer[0];if(a===1)return Integer[1];if(a===-1)return n.isEven()?Integer[1]:Integer[-1];if(n.sign){return Integer[0]}if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall){if(isPrecise(value=Math.pow(a,b)))return new SmallInteger(truncate(value))}x=this;y=Integer[1];while(true){if((x & -x&1)===1){y=y.times(x);--b}if(b===0)break;b/=2;x=x.square()}return y};SmallInteger.prototype.pow=BigInteger.prototype.pow;NativeBigInt.prototype.pow=function(v){var n=parseValue(v);var a=this.value,b=n.value;var _0=BigInt(0),_1=BigInt(1),_2=BigInt(2);if(b===_0)return Integer[1];if(a===_0)return Integer[0];if(a===_1)return Integer[1];if(a===BigInt(-1))return n.isEven()?Integer[1]:Integer[-1];if(n.isNegative())return new NativeBigInt(_0);var x=this;var y=Integer[1];while(true){if((b&_1)===_1){y=y.times(x);--b}if(b===_0)break;b/=_2;x=x.square()}return y};BigInteger.prototype.modPow=function(exp,mod){exp=parseValue(exp);mod=parseValue(mod);if(mod.isZero())throw new Error("Cannot take modPow with modulus 0");var r=Integer[1],base=this.mod(mod);while(exp.isPositive()){if(base.isZero())return Integer[0];if(exp.isOdd())r=r.multiply(base).mod(mod);exp=exp.divide(2);base=base.square().mod(mod)}return r};NativeBigInt.prototype.modPow=SmallInteger.prototype.modPow=BigInteger.prototype.modPow;function compareAbs(a,b){if(a.length!==b.length){return a.length>b.length?1:-1}for(var i=a.length-1;i>=0;i--){if(a[i]!==b[i])return a[i]>b[i]?1:-1}return 0}BigInteger.prototype.compareAbs=function(v){var n=parseValue(v),a=this.value,b=n.value;if(n.isSmall)return 1;return compareAbs(a,b)};SmallInteger.prototype.compareAbs=function(v){var n=parseValue(v),a=Math.abs(this.value),b=n.value;if(n.isSmall){b=Math.abs(b);return a===b?0:a>b?1:-1}return-1};NativeBigInt.prototype.compareAbs=function(v){var a=this.value;var b=parseValue(v).value;a=a>=0?a:-a;b=b>=0?b:-b;return a===b?0:a>b?1:-1};BigInteger.prototype.compare=function(v){if(v===Infinity){return-1}if(v===-Infinity){return 1}var n=parseValue(v),a=this.value,b=n.value;if(this.sign!==n.sign){return n.sign?1:-1}if(n.isSmall){return this.sign?-1:1}return compareAbs(a,b)*(this.sign?-1:1)};BigInteger.prototype.compareTo=BigInteger.prototype.compare;SmallInteger.prototype.compare=function(v){if(v===Infinity){return-1}if(v===-Infinity){return 1}var n=parseValue(v),a=this.value,b=n.value;if(n.isSmall){return a==b?0:a>b?1:-1}if(a<0!==n.sign){return a<0?-1:1}return a<0?1:-1};SmallInteger.prototype.compareTo=SmallInteger.prototype.compare;NativeBigInt.prototype.compare=function(v){if(v===Infinity){return-1}if(v===-Infinity){return 1}var a=this.value;var b=parseValue(v).value;return a===b?0:a>b?1:-1};NativeBigInt.prototype.compareTo=NativeBigInt.prototype.compare;BigInteger.prototype.equals=function(v){return this.compare(v)===0};NativeBigInt.prototype.eq=NativeBigInt.prototype.equals=SmallInteger.prototype.eq=SmallInteger.prototype.equals=BigInteger.prototype.eq=BigInteger.prototype.equals;BigInteger.prototype.notEquals=function(v){return this.compare(v)!==0};NativeBigInt.prototype.neq=NativeBigInt.prototype.notEquals=SmallInteger.prototype.neq=SmallInteger.prototype.notEquals=BigInteger.prototype.neq=BigInteger.prototype.notEquals;BigInteger.prototype.greater=function(v){return this.compare(v)>0};NativeBigInt.prototype.gt=NativeBigInt.prototype.greater=SmallInteger.prototype.gt=SmallInteger.prototype.greater=BigInteger.prototype.gt=BigInteger.prototype.greater;BigInteger.prototype.lesser=function(v){return this.compare(v)<0};NativeBigInt.prototype.lt=NativeBigInt.prototype.lesser=SmallInteger.prototype.lt=SmallInteger.prototype.lesser=BigInteger.prototype.lt=BigInteger.prototype.lesser;BigInteger.prototype.greaterOrEquals=function(v){return this.compare(v)>=0};NativeBigInt.prototype.geq=NativeBigInt.prototype.greaterOrEquals=SmallInteger.prototype.geq=SmallInteger.prototype.greaterOrEquals=BigInteger.prototype.geq=BigInteger.prototype.greaterOrEquals;BigInteger.prototype.lesserOrEquals=function(v){return this.compare(v)<=0};NativeBigInt.prototype.leq=NativeBigInt.prototype.lesserOrEquals=SmallInteger.prototype.leq=SmallInteger.prototype.lesserOrEquals=BigInteger.prototype.leq=BigInteger.prototype.lesserOrEquals;BigInteger.prototype.isEven=function(){return(this.value[0]&1)===0};SmallInteger.prototype.isEven=function(){return(this.value&1)===0};NativeBigInt.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)};BigInteger.prototype.isOdd=function(){return(this.value[0]&1)===1};SmallInteger.prototype.isOdd=function(){return(this.value&1)===1};NativeBigInt.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)};BigInteger.prototype.isPositive=function(){return!this.sign};SmallInteger.prototype.isPositive=function(){return this.value>0};NativeBigInt.prototype.isPositive=SmallInteger.prototype.isPositive;BigInteger.prototype.isNegative=function(){return this.sign};SmallInteger.prototype.isNegative=function(){return this.value<0};NativeBigInt.prototype.isNegative=SmallInteger.prototype.isNegative;BigInteger.prototype.isUnit=function(){return false};SmallInteger.prototype.isUnit=function(){return Math.abs(this.value)===1};NativeBigInt.prototype.isUnit=function(){return this.abs().value===BigInt(1)};BigInteger.prototype.isZero=function(){return false};SmallInteger.prototype.isZero=function(){return this.value===0};NativeBigInt.prototype.isZero=function(){return this.value===BigInt(0)};BigInteger.prototype.isDivisibleBy=function(v){var n=parseValue(v);if(n.isZero())return false;if(n.isUnit())return true;if(n.compareAbs(2)===0)return this.isEven();return this.mod(n).isZero()};NativeBigInt.prototype.isDivisibleBy=SmallInteger.prototype.isDivisibleBy=BigInteger.prototype.isDivisibleBy;function isBasicPrime(v){var n=v.abs();if(n.isUnit())return false;if(n.equals(2)||n.equals(3)||n.equals(5))return true;if(n.isEven()||n.isDivisibleBy(3)||n.isDivisibleBy(5))return false;if(n.lesser(49))return true}function millerRabinTest(n,a){var nPrev=n.prev(),b=nPrev,r=0,d,t,i,x;while(b.isEven())b=b.divide(2),r++;next:for(i=0;i<a.length;i++){if(n.lesser(a[i]))continue;x=bigInt(a[i]).modPow(b,n);if(x.isUnit()||x.equals(nPrev))continue;for(d=r-1;d!=0;d--){x=x.square().mod(n);if(x.isUnit())return false;if(x.equals(nPrev))continue next}return false}return true}BigInteger.prototype.isPrime=function(strict){var isPrime=isBasicPrime(this);if(isPrime!==undefined)return isPrime;var n=this.abs();var bits=n.bitLength();if(bits<=64)return millerRabinTest(n,[2,3,5,7,11,13,17,19,23,29,31,37]);var logN=Math.log(2)*bits.toJSNumber();var t=Math.ceil(strict===true?2*Math.pow(logN,2):logN);for(var a=[],i=0;i<t;i++){a.push(bigInt(i+2))}return millerRabinTest(n,a)};NativeBigInt.prototype.isPrime=SmallInteger.prototype.isPrime=BigInteger.prototype.isPrime;BigInteger.prototype.isProbablePrime=function(iterations){var isPrime=isBasicPrime(this);if(isPrime!==undefined)return isPrime;var n=this.abs();var t=iterations===undefined?5:iterations;for(var a=[],i=0;i<t;i++){a.push(bigInt.randBetween(2,n.minus(2)))}return millerRabinTest(n,a)};NativeBigInt.prototype.isProbablePrime=SmallInteger.prototype.isProbablePrime=BigInteger.prototype.isProbablePrime;
BigInteger.prototype.modInv=function(n){var t=bigInt.zero,newT=bigInt.one,r=parseValue(n),newR=this.abs(),q,lastT,lastR;while(!newR.isZero()){q=r.divide(newR);lastT=t;lastR=r;t=newT;r=newR;newT=lastT.subtract(q.multiply(newT));newR=lastR.subtract(q.multiply(newR))}if(!r.isUnit())throw new Error(this.toString()+" and "+n.toString()+" are not co-prime");if(t.compare(0)===-1){t=t.add(n)}if(this.isNegative()){return t.negate()}return t};NativeBigInt.prototype.modInv=SmallInteger.prototype.modInv=BigInteger.prototype.modInv;BigInteger.prototype.next=function(){var value=this.value;if(this.sign){return subtractSmall(value,1,this.sign)}return new BigInteger(addSmall(value,1),this.sign)};SmallInteger.prototype.next=function(){var value=this.value;if(value+1<MAX_INT)return new SmallInteger(value+1);return new BigInteger(MAX_INT_ARR,false)};NativeBigInt.prototype.next=function(){return new NativeBigInt(this.value+BigInt(1))};BigInteger.prototype.prev=function(){var value=this.value;if(this.sign){return new BigInteger(addSmall(value,1),true)}return subtractSmall(value,1,this.sign)};SmallInteger.prototype.prev=function(){var value=this.value;if(value-1>-MAX_INT)return new SmallInteger(value-1);return new BigInteger(MAX_INT_ARR,true)};NativeBigInt.prototype.prev=function(){return new NativeBigInt(this.value-BigInt(1))};var powersOfTwo=[1];while(2*powersOfTwo[powersOfTwo.length-1]<=BASE)powersOfTwo.push(2*powersOfTwo[powersOfTwo.length-1]);var powers2Length=powersOfTwo.length,highestPower2=powersOfTwo[powers2Length-1];function shift_isSmall(n){return Math.abs(n)<=BASE}BigInteger.prototype.shiftLeft=function(v){var n=parseValue(v).toJSNumber();if(!shift_isSmall(n)){throw new Error(String(n)+" is too large for shifting.")}if(n<0)return this.shiftRight(-n);var result=this;if(result.isZero())return result;while(n>=powers2Length){result=result.multiply(highestPower2);n-=powers2Length-1}return result.multiply(powersOfTwo[n])};NativeBigInt.prototype.shiftLeft=SmallInteger.prototype.shiftLeft=BigInteger.prototype.shiftLeft;BigInteger.prototype.shiftRight=function(v){var remQuo;var n=parseValue(v).toJSNumber();if(!shift_isSmall(n)){throw new Error(String(n)+" is too large for shifting.")}if(n<0)return this.shiftLeft(-n);var result=this;while(n>=powers2Length){if(result.isZero()||result.isNegative()&&result.isUnit())return result;remQuo=divModAny(result,highestPower2);result=remQuo[1].isNegative()?remQuo[0].prev():remQuo[0];n-=powers2Length-1}remQuo=divModAny(result,powersOfTwo[n]);return remQuo[1].isNegative()?remQuo[0].prev():remQuo[0]};NativeBigInt.prototype.shiftRight=SmallInteger.prototype.shiftRight=BigInteger.prototype.shiftRight;function bitwise(x,y,fn){y=parseValue(y);var xSign=x.isNegative(),ySign=y.isNegative();var xRem=xSign?x.not():x,yRem=ySign?y.not():y;var xDigit=0,yDigit=0;var xDivMod=null,yDivMod=null;var result=[];while(!xRem.isZero()||!yRem.isZero()){xDivMod=divModAny(xRem,highestPower2);xDigit=xDivMod[1].toJSNumber();if(xSign){xDigit=highestPower2-1-xDigit}yDivMod=divModAny(yRem,highestPower2);yDigit=yDivMod[1].toJSNumber();if(ySign){yDigit=highestPower2-1-yDigit}xRem=xDivMod[0];yRem=yDivMod[0];result.push(fn(xDigit,yDigit))}var sum=fn(xSign?1:0,ySign?1:0)!==0?bigInt(-1):bigInt(0);for(var i=result.length-1;i>=0;i-=1){sum=sum.multiply(highestPower2).add(bigInt(result[i]))}return sum}BigInteger.prototype.not=function(){return this.negate().prev()};NativeBigInt.prototype.not=SmallInteger.prototype.not=BigInteger.prototype.not;BigInteger.prototype.and=function(n){return bitwise(this,n,function(a,b){return a&b})};NativeBigInt.prototype.and=SmallInteger.prototype.and=BigInteger.prototype.and;BigInteger.prototype.or=function(n){return bitwise(this,n,function(a,b){return a|b})};NativeBigInt.prototype.or=SmallInteger.prototype.or=BigInteger.prototype.or;BigInteger.prototype.xor=function(n){return bitwise(this,n,function(a,b){return a^b})};NativeBigInt.prototype.xor=SmallInteger.prototype.xor=BigInteger.prototype.xor;var LOBMASK_I=1<<30,LOBMASK_BI=(BASE&-BASE)*(BASE&-BASE)|LOBMASK_I;function roughLOB(n){var v=n.value,x:any=typeof v==="number"?v|LOBMASK_I:typeof v==="bigint"?v|BigInt(LOBMASK_I):v[0]+v[1]*BASE|LOBMASK_BI;return x&-x}function integerLogarithm(value,base){if(base.compareTo(value)<=0){var tmp=integerLogarithm(value,base.square(base));var p=tmp.p;var e=tmp.e;var t=p.multiply(base);return t.compareTo(value)<=0?{p:t,e:e*2+1}:{p:p,e:e*2}}return{p:bigInt(1),e:0}}BigInteger.prototype.bitLength=function(){var n=this;if(n.compareTo(bigInt(0))<0){n=n.negate().subtract(bigInt(1))}if(n.compareTo(bigInt(0))===0){return bigInt(0)}return bigInt(integerLogarithm(n,bigInt(2)).e).add(bigInt(1))};NativeBigInt.prototype.bitLength=SmallInteger.prototype.bitLength=BigInteger.prototype.bitLength;function max(a,b){a=parseValue(a);b=parseValue(b);return a.greater(b)?a:b}function min(a,b){a=parseValue(a);b=parseValue(b);return a.lesser(b)?a:b}function gcd(a,b){a=parseValue(a).abs();b=parseValue(b).abs();if(a.equals(b))return a;if(a.isZero())return b;if(b.isZero())return a;var c=Integer[1],d,t;while(a.isEven()&&b.isEven()){d=min(roughLOB(a),roughLOB(b));a=a.divide(d);b=b.divide(d);c=c.multiply(d)}while(a.isEven()){a=a.divide(roughLOB(a))}do{while(b.isEven()){b=b.divide(roughLOB(b))}if(a.greater(b)){t=b;b=a;a=t}b=b.subtract(a)}while(!b.isZero());return c.isUnit()?a:a.multiply(c)}function lcm(a,b){a=parseValue(a).abs();b=parseValue(b).abs();return a.divide(gcd(a,b)).multiply(b)}function randBetween(a,b){a=parseValue(a);b=parseValue(b);var low=min(a,b),high=max(a,b);var range=high.subtract(low).add(1);if(range.isSmall)return low.add(Math.floor(Math.random()*range));var digits=toBase(range,BASE).value;var result=[],restricted=true;for(var i=0;i<digits.length;i++){var top=restricted?digits[i]:BASE;var digit=truncate(Math.random()*top);result.push(digit);if(digit<top)restricted=false}return low.add(Integer.fromArray(result,BASE,false))}var parseBase=function(text,base,alphabet,caseSensitive){alphabet=alphabet||DEFAULT_ALPHABET;text=String(text);if(!caseSensitive){text=text.toLowerCase();alphabet=alphabet.toLowerCase()}var length=text.length;var i;var absBase=Math.abs(base);var alphabetValues={};for(i=0;i<alphabet.length;i++){alphabetValues[alphabet[i]]=i}for(i=0;i<length;i++){var c=text[i];if(c==="-")continue;if(c in alphabetValues){if(alphabetValues[c]>=absBase){if(c==="1"&&absBase===1)continue;throw new Error(c+" is not a valid digit in base "+base+".")}}}base=parseValue(base);var digits=[];var isNegative=text[0]==="-";for(i=isNegative?1:0;i<text.length;i++){var c=text[i];if(c in alphabetValues)digits.push(parseValue(alphabetValues[c]));else if(c==="<"){var start=i;do{i++}while(text[i]!==">"&&i<text.length);digits.push(parseValue(text.slice(start+1,i)))}else throw new Error(c+" is not a valid character")}return parseBaseFromArray(digits,base,isNegative)};function parseBaseFromArray(digits,base,isNegative){var val=Integer[0],pow=Integer[1],i;for(i=digits.length-1;i>=0;i--){val=val.add(digits[i].times(pow));pow=pow.times(base)}return isNegative?val.negate():val}function stringify(digit,alphabet){alphabet=alphabet||DEFAULT_ALPHABET;if(digit<alphabet.length){return alphabet[digit]}return"<"+digit+">"}function toBase(n,base){base=bigInt(base);if(base.isZero()){if(n.isZero())return{value:[0],isNegative:false};throw new Error("Cannot convert nonzero numbers to base 0.")}if(base.equals(-1)){if(n.isZero())return{value:[0],isNegative:false};if(n.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-n.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:false};var arr=Array.apply(null,Array(n.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);arr.unshift([1]);return{value:[].concat.apply([],arr),isNegative:false}}var neg=false;if(n.isNegative()&&base.isPositive()){neg=true;n=n.abs()}if(base.isUnit()){if(n.isZero())return{value:[0],isNegative:false};return{value:Array.apply(null,Array(n.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:neg}}var out=[];var left=n,divmod;while(left.isNegative()||left.compareAbs(base)>=0){divmod=left.divmod(base);left=divmod.quotient;var digit=divmod.remainder;if(digit.isNegative()){digit=base.minus(digit).abs();left=left.next()}out.push(digit.toJSNumber())}out.push(left.toJSNumber());return{value:out.reverse(),isNegative:neg}}function toBaseString(n,base,alphabet){var arr=toBase(n,base);return(arr.isNegative?"-":"")+arr.value.map(function(x){return stringify(x,alphabet)}).join("")}BigInteger.prototype.toArray=function(radix){return toBase(this,radix)};SmallInteger.prototype.toArray=function(radix){return toBase(this,radix)};NativeBigInt.prototype.toArray=function(radix){return toBase(this,radix)};BigInteger.prototype.toString=function(radix,alphabet){if(radix===undefined)radix=10;if(radix!==10)return toBaseString(this,radix,alphabet);var v=this.value,l=v.length,str=String(v[--l]),zeros="0000000",digit;while(--l>=0){digit=String(v[l]);str+=zeros.slice(digit.length)+digit}var sign=this.sign?"-":"";return sign+str};SmallInteger.prototype.toString=function(radix,alphabet){if(radix===undefined)radix=10;if(radix!=10)return toBaseString(this,radix,alphabet);return String(this.value)};NativeBigInt.prototype.toString=SmallInteger.prototype.toString;NativeBigInt.prototype.toJSON=BigInteger.prototype.toJSON=SmallInteger.prototype.toJSON=function(){return this.toString()};BigInteger.prototype.valueOf=function(){return parseInt(this.toString(),10)};BigInteger.prototype.toJSNumber=BigInteger.prototype.valueOf;SmallInteger.prototype.valueOf=function(){return this.value};SmallInteger.prototype.toJSNumber=SmallInteger.prototype.valueOf;NativeBigInt.prototype.valueOf=NativeBigInt.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function parseStringValue(v){if(isPrecise(+v)){var x=+v;if(x===truncate(x))return supportsNativeBigInt?new NativeBigInt(BigInt(x)):new SmallInteger(x);throw new Error("Invalid integer: "+v)}var sign=v[0]==="-";if(sign)v=v.slice(1);var split=v.split(/e/i);if(split.length>2)throw new Error("Invalid integer: "+split.join("e"));if(split.length===2){var exp=split[1];if(exp[0]==="+")exp=exp.slice(1);exp=+exp;if(exp!==truncate(exp)||!isPrecise(exp))throw new Error("Invalid integer: "+exp+" is not a valid exponent.");var text=split[0];var decimalPlace=text.indexOf(".");if(decimalPlace>=0){exp-=text.length-decimalPlace-1;text=text.slice(0,decimalPlace)+text.slice(decimalPlace+1)}if(exp<0)throw new Error("Cannot include negative exponent part for integers");text+=new Array(exp+1).join("0");v=text}var isValid=/^([0-9][0-9]*)$/.test(v);if(!isValid)throw new Error("Invalid integer: "+v);if(supportsNativeBigInt){return new NativeBigInt(BigInt(sign?"-"+v:v))}var r=[],max=v.length,l=LOG_BASE,min=max-l;while(max>0){r.push(+v.slice(min,max));min-=l;if(min<0)min=0;max-=l}trim(r);return new BigInteger(r,sign)}function parseNumberValue(v){if(supportsNativeBigInt){return new NativeBigInt(BigInt(v))}if(isPrecise(v)){if(v!==truncate(v))throw new Error(v+" is not an integer.");return new SmallInteger(v)}return parseStringValue(v.toString())}function parseValue(v){if(typeof v==="number"){return parseNumberValue(v)}if(typeof v==="string"){return parseStringValue(v)}if(typeof v==="bigint"){return new NativeBigInt(v)}return v}for(var i=0;i<1e3;i++){Integer[i]=parseValue(i);if(i>0)Integer[-i]=parseValue(-i)}Integer.one=Integer[1];Integer.zero=Integer[0];Integer.minusOne=Integer[-1];Integer.max=max;Integer.min=min;Integer.gcd=gcd;Integer.lcm=lcm;Integer.isInstance=function(x){return x instanceof BigInteger||x instanceof SmallInteger||x instanceof NativeBigInt};Integer.randBetween=randBetween;Integer.fromArray=function(digits,base,isNegative){return parseBaseFromArray(digits.map(parseValue),parseValue(base||10),isNegative)};return Integer}();if(typeof module!=="undefined"&&module.hasOwnProperty("exports")){module.exports=bigInt}
const main=()=>{
  let [w,h,x,y]=tnn(4),d=0
  let a=bigInt(min(w-x,x)).multiply(h)
  let b=bigInt(min(h-y,y)).multiply(w)
  if(a.toString()==b.toString())d=1
  to(max(a,b).toFixed(6)+' '+d)
}
main()


a = list(map(int,input().split()))
a.sort()
b = list(map(lambda x:x%2,a))
ans = 0

if sum(b) in (1,2):
    ans += 1
    for i in range(3):
        if sum(b) == 1:
            a[i] -= b[i]
        else:
            a[i] += b[i]

ans += (a[2]-a[0])//2+ (a[2]-a[1])//2
print(ans)


a, b, c = map(int, input().split())

ans = 3 * max(a, b, c) - (a + b + c)

if ans % 2 == 0:
    print(int(ans / 2))
elif ans % 2 == 1:
    print(int((ans + 3) / 2))


abc = sorted(list(map(int, input().split())), reverse=True)
ans = 0

if abc[1]%2 != 0 and abc[2]%2 == 0:
    ans += 1
    abc[0] += 1
    abc[1] += 1

elif abc[1]%2 == 0 and abc[2]%2 != 0:
    ans += 1
    abc[0] += 1
    abc[2] += 1

ans += abc[0] - abc[1]
ans += (abc[1] - abc[2])//2

print(ans)


a,b,c = map(int, input().split())

s = a+b+c
cnt = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s//3>= c:
            break
print(cnt)


a,b,c = map(int, input().split())

s = a+b+c
cnt = 0
f = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s//3>= c:
            f = 1
    if f:
        break
print(cnt)


a,b,c = map(int, input().split())

s = a+b+c
cnt = 0
f = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s>= c:
            f = 1
    if f:
        break
print(cnt)


import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int[] array = new int[3];
        int answer = 0;

        for(int i = 0; i < 3; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        Arrays.sort(array);
        for(int i = 0; i < 3; i++){
            array[i] = array[2] - array[i];
        }

        if(array[0] + array[1] == 0){
            //do nothing.
        }else if(array[0] != array[1] && array[1] != array[2]){
            if(array[0] % 2 == array[1] % 2){
                answer += (array[0] - array[1]) / 2;
                answer += array[1];
            }else if(array[0] % 2 == 0){
                answer++;
                array[0]--;
                answer += array[0]/2 + 1;
                answer += array[1]/2 + 1;
            }else if(array[1] % 2 == 0){
                answer++;
                array[1]--;
                answer += array[0]/2 + 1;
                answer += array[1]/2 + 1;
            }
        }else if(array[0] == array[1]){
            answer += array[0];
        }else if(array[1] == array[2]){
            answer += array[0]%2;
            answer += (array[0]+1)/2;
        }

        System.out.println(answer);
    }
}


import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int[] num = { A, B, C };
		Arrays.sort(num);
		int ans = 0;
		ans += num[2] - num[1];
		ans += (num[1] - num[0]) / 2;

		if ((num[1] - num[0]) % 2 == 1)
			ans += 2;

		System.out.println(ans);

	}

	//以下、自作ライブラリ

	/*
		int N = sc.nextInt();

		int[] a = new int[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.nextInt();

		String s = sc.next();

		String[] a = new String[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.next();
	 */

	//階乗
	public static int fact(int n) {
		if (n == 1 || n == 0)
			return 1;
		else
			return n * fact(n - 1);
	}

	//指定した値以上の要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long lowerBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] < y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//指定した値より大きい要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long upperBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] <= y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int n = 3;
		int[] a = in.nextIntArray(n);
		Arrays.sort(a);
		int[] dif = new int[2];
		dif[0] = a[2] - a[0];
		dif[1] = a[2] - a[1];
		int ans = 0, temp = a[2] - a[1];
		ans += temp;
		dif[0] -= temp;
		if (dif[0] % 2 == 0)
			ans += dif[0] / 2;
		else {
			ans += dif[0] / 2 + 2;
		}

		w.println(ans);

		w.close();
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int sum = a+b+c;
    int max = Math.max(Math.max(a,b),c);
    int min = Math.min(Math.min(a,b),c);
    int middle = sum-max-min;
    int count = 0;
    if((3*max)%2 != sum%2) {
      max++;
      count++;
    }
    count+=(3*max-sum)/2;

    System.out.println(count);
  }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int[] num = new int[3];
    for(int i=0; i<3; i++) {
      num[i] = Integer.parseInt(str[i]);
    }

    Arrays.sort(num);

    int count = num[2]-num[1];
    count += (num[1]-num[0])/2;
    if((num[2]-num[1])%2!=0)
      count+=2;
    System.out.println(count);
  }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Integer[] arr = new Integer[3];
        int total = 0;
        for(int i = 0; i < 3; i++) {
            arr[i] = sc.nextInt();
            total += arr[i];
        }
        Arrays.sort(arr, Collections.reverseOrder());

        int cnt = 0;
        while(total%3!=0 || arr[0]*3>total) {
            cnt++;
            total+=2;
        }
        System.out.println(cnt);
    }
}


#include<stdio.h>
typedef long long ll;
ll a,b,c;
int main(){
	scanf("%lld %lld %lld",&a,&b,&c);
	if(b >= c && b >= a) {ll tmp = a; a = b; b = tmp;}
	else if(c >= b && c >= a) {ll tmp = a; a = c; c = tmp;}

	int cnt = 0;
	while(b <= a-2) b += 2,cnt++;
	while(c <= a-2) c += 2,cnt++;

	if(a == b && b == c)printf("%d",cnt);
	else if(b <a && c < a) printf("%d",cnt+1);
	else printf("%d",cnt+2);
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> v(3);
int main(){
	cin >> v[0] >> v[1] >> v[2];
	sort(v.begin(),v.end());
	int a = (v[1]-v[0])%2;
	if(a==1) cout << (v[1]-v[0])/2 + 1 + v[2]-v[1]+1 << endl;
	else cout << (v[1]-v[0])/2 + v[2]-v[1] << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int sum = a + b + c;
    int max = a;
    if (max < b) max = b;
    if (max < c) max = c;
    int res = max * 3 - sum;
    if (res % 2 == 0) {
        cout << res / 2 << endl;
    } else {
        cout << (res + 3) / 2 << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vector<int> s(3);
    for(int i=0; i<3; i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());
    int cnt = 0;
    cnt += (s.at(2)-s.at(1));
    if(s.at(2)-((s.at(0))+cnt)%2==1){
        cnt += (s.at(2) - (s.at(0) + cnt))/2 + 2;
    }
    else{
        cnt += (s.at(2) - (s.at(0)+cnt))/2;
    }
    cout << cnt << endl;
    return 0;
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}

int main()
{
  ll a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);

  cout<<a[2]-a[1]-a[0]+(a[1]+a[0])/2+(a[1]+a[0])%2<<endl;

  return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    vector<int> vec(3);
    for (int i=0; i<3; i++){
        cin >> vec[i];
    }
    sort(begin(vec), end(vec));
    int ans=0;
    ans += (vec[1] - vec[0]) / 2;
    vec[0] += ans * 2;
    if (vec[0] != vec[1]){
        vec[2] += 1;
    }
    ans += vec[2] - vec[1];
    cout << ans << endl;
    return 0;
}


#include <stdio.h>

int main (void)
{
    int a, b, c, max, ax, bx, cx, x, m;
    scanf("%d %d %d", &a, &b, &c);

    max = a;
    if (max < b) max = b;
    if (max < c) max = c;

    ax = (max - a) / 2;
    bx = (max - b) / 2;
    cx = (max - c) / 2;

    a = 2 * ax + a;
    b = 2 * bx + b;
    c = 2 * cx + c;

    x = ax + bx + cx;

    max = a;
    if (max < b) max = b;
    if (max < c) max = c;

    m = (max - a);
    m += (max - b);
    m += (max - c);

    if (m == 2) x += 1;
    if (m == 1) x += 2;

    printf("%d\n", x);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);

	int sum = A + B + C, max = (A < B)? ((B < C)? C: B): (C < A)? A: C;
	if ((sum - max) % 2 == 0) printf("%d\n", (max * 3 - sum) / 2);
	else printf("%d\n", (max * 3 - sum + 3) / 2);
	fflush(stdout);
	return 0;
}


#include<stdio.h>
int main(){
  int a,b,c,count;
  scanf("%d%d%d",&a,&b,&c);
  if(a>=b && a>=c)
    count=2*a-b-c;
  else if(b>=a && b>=c)
    count=2*b-a-c;
  else
    count=2*c-a-b;
  if(count%2==0)
    printf("%d\n",count/2);
  else
    printf("%d\n",(count+3)/2);
  return 0;
}


#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    vector<int> s(3);
    rep(i,3) cin>>s[i];
    sort(all(s));
    int a=s[2],b=s[1],c=s[0],cnt=0;
    if((a-b)%2==(a-c)%2) cnt=a-b+(b-c)/2;
    else cnt=a-b+(b-c+1)/2+1;
    cout<<cnt;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if(a<b) swap(a,b);
    if(a<c) swap(a,c);
    if(b<c) swap(b,c);

    if(3*a%2==(a+b+c)%2){
        cout << (2*a - b - c)/2 << endl;
    }
    else{
        cout << (2*a + 3 - b - c)/2 << endl;
    }

   return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) {
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) {
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  int sum = a + b + c;
  int max = max(a, max(b ,c));
  int ans;
  rep(i, max, 51) {
    if ( (i * 3 - sum) % 2 != 0 ) continue;
    ans = (i * 3 - sum) / 2;
    break;
  }
  printf("%d\n", ans);
  return 0;
}


"use strict"
function Main(input) {
  input = input.trim().split(' ').map(Number);
  const A = input[0];
  const B = input[1];
  const C = input[2];
  let sum = A + B + C;
  let max = Math.max(A, B, C);
  let M = 3 * max;

  let ret = 0;
  if(M%2 === sum%2){
    ret = (M-sum)/2;
  } else {
    ret = (M+3-sum)/2;
  }

  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
    var a = input[0].split(" ")[0]-0;
    var b = input[0].split(" ")[1]-0;
    var c = input[0].split(" ")[2]-0;
    var ans = 0;
    var max = Math.max(Math.max(a,b),c);
    if(b==max){
        b = a;
        a = max;
    }else if(c==max){
        c = a;
        a = max;
    }
    ans += a-Math.max(b,c);
    if((a - ans - Math.min(b,c))%2 == 0){
        ans += (a-ans-Math.min(b,c))/2;
    }else{
        ans += ~~((a-ans-Math.min(b,c))/2)+2;
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

//1 2 3 4 5 6


function calc(input) {
  var array = input.split(' ');
  var A = parseInt(array[0]);
  var B = parseInt(array[1]);
  var C = parseInt(array[2]);

  if (A === B === C) {
    return 0;
  }

  var max = Math.max(A, B, C);
  var min = Math.min(A, B, C);

  if (A === B === max || B === C === max || C === A === max) {
    return Math.floor((max - min) / 2) + ((max - mod) % 2 === 0 ? 0 : 2);
  }

  if (A === B === min || B === C === min || C === A === min) {
    return max - min;
  }

  var mid;
  if (A === max) {
    mid = B === min ? C : B;
  } else if (B === max) {
    mid = A === min ? C : A;
  } else {
    mid = A === min ? B : A;
  }

  var diffFromMidToMax = max - mid;
  var diffFromMinToMid = mid - min;
  var isMod0 = diffFromMinToMid % 2 === 0;

  return diffFromMidToMax + Math.floor(diffFromMinToMid / 2) + (isMod0 ? 0 : 2);
}

function main(input) {
  console.log(calc(input));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


'use strict'

function main(input) {
    input = input.split(/\n|\s/).map(v => ~~v)
    let A = input[0]
    let B = input[1]
    let C = input[2]

    const sum = A + B + C
    let goal = Math.max.apply(null, input) * 3

    if (sum % 2 == goal % 2) {
        // console.log(sum % 2, goal % 2)
    } else {

        goal += 1
    }

    const ans = Math.ceil((goal - sum) / 2)

    console.log(ans)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


import java.util.Scanner;

class Contest93C {

    static void Compare3Figures(int a, int b, int c) {
        if (b < a && a < c) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        else if (b < a && c < b) {
            int tmptwo = a;
            a = c;
            c = tmptwo;
        }

        else if (a < b && c < b && a < c) {
            int tmpthree = b;
            b = c;
            c = tmpthree;
        }

        else if (a < b && c < a) {
            int tmpfour = a;
            a = c;
            c = b;
            b = tmpfour;
        }

        else if (b < a && b < c && c < a) {
            int tmpfive = a;
            a = b;
            b = c;
            c = tmpfive;

        }

        OddEvenCheck(a, b, c);

    }

    static void OddEvenCheck(int a, int b, int c) {
        int OddorEvenOne = (b - a) % 2;
        int OddorEvenTwo = (c - b) % 2;

        if (OddorEvenOne == 0 && OddorEvenTwo == 0) {
            System.out.print(MakeEqual3Figures(a, b, c));
        }

        else if (OddorEvenOne != 0 && OddorEvenTwo != 0) {
            a = a + 1;
            c = c + 1;
            System.out.print(MakeEqual3Figures(a, b, c) + 1);
        }

        else if (OddorEvenOne == 0 && OddorEvenTwo != 0) {
            a = a + 1;
            b = b + 1;
            System.out.print(MakeEqual3Figures(a, b, c) + 1);
        }

        else if (OddorEvenOne != 0 && OddorEvenTwo == 0) {
            b = b + 1;
            c = c + 1;
            System.out.print(MakeEqual3Figures(a, b, c) + 1);
        }

    }

    static int MakeEqual3Figures(int a, int b, int c) {
        int countone = 0;
        int counttwo = 0;
        int resultone = 0;

        while (a != c) {
            a += 2;
            countone++;
        }

        while (b != c) {
            b += 2;
            counttwo++;
        }

        resultone = countone + counttwo;
        return resultone;
    }

    public static void main(String args[]) {
        Scanner stdIn = new Scanner(System.in);

        int A = 0;
        int B = 0;
        int C = 0;

        do {
            A = stdIn.nextInt();
        } while (A < 0 || 50 < A);

        do {
            B = stdIn.nextInt();
        } while (B < 0 || 50 < B);

        do {
            C = stdIn.nextInt();
        } while (C < 0 || 50 < C);

        Compare3Figures(A, B, C);

        System.out.println(" ");
    }
}


function calc(input) {
  var array = input.split(' ');
  var A = parseInt(array[0]);
  var B = parseInt(array[1]);
  var C = parseInt(array[2]);

  if (A === B === C) {
    return 0;
  }

  var max = Math.max(A, B, C);
  var min = Math.min(A, B, C);

  if (A === B || B === C || C === A) {
    return max - min;
  }

  var mid;
  if (A === max) {
    mid = B === min ? C : B;
  } else if (B === max) {
    mid = A === min ? C : A;
  } else {
    mid = A === min ? B : A;
  }

  var diffFromMidToMax = max - mid;
  var diffFromMinToMid = mid - min;
  var isMod0 = diffFromMinToMid % 2 === 0;

  return diffFromMidToMax + Math.floor(diffFromMinToMid / 2) + (isMod0 ? 0 : 2);
}

function main(input) {
  console.log(calc(input));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func max(x ...int) int {
	m := x[0]
	for i := 1; i < len(x); i++ {
		if m < x[i] {
			m = x[i]
		}
	}

	return m
}

func main() {
	a, b, c := nextInt(), nextInt(), nextInt()

	m := max(a, b, c)
	if m%2 == (a+b+c)%2 {
		fmt.Println((3*m - a - b - c) / 2)
	} else {
		fmt.Println((3*(m+1) - a - b - c) / 2)
	}
}


package main

import "fmt"

func largest(a, b, c int) (lgst int) {
	if a > b {
		lgst = a
	} else {
		lgst = b
	}
	if c > lgst {
		lgst = c
	}
	return
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	max := largest(a, b, c)
	sum := a + b + c

	diff := 3*max - sum
	if diff%2 == 1 {
		diff += 3
	}
	ans := diff / 2
	fmt.Println(ans)
}


package main

import (
	"fmt"
)

func main() {
	var A, B, C int
	fmt.Scan(&A, &B, &C)

	max := max(A, max(B, C))
	sum := A + B + C

	if max%2 != sum%2 {
		max++
	}
	fmt.Println((3*max - sum) / 2)
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	A := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&A[i])
	}
	sort.Ints(A)

	ans := (A[2]*2-A[1]-A[0])/2 + (A[2]*2-A[1]-A[0])%2
	fmt.Println(ans)
}


package main
import (
	"fmt"
	"sort"
)
func main(){
	A := make([]int, 3)
	for i:=0; i<3; i++{
		fmt.Scan(&A[i])
	}
	sort.Ints(A)
	minimum,maximum := A[0], A[2]
	if minimum == maximum{
		fmt.Println(0)
		return
	}
	ans := 0
	if (maximum-minimum)%2 == 0{
		ans += (maximum - minimum)/2
		A[0] += (maximum - minimum)
	}else{
		A[1]++
		ans += (maximum - minimum)/2 + 1
		A[0] += (maximum - minimum)
	}
	sort.Ints(A)
	if (A[2]-A[0])%2==0{
		ans += (A[2]-A[0])/2
	}else{
		if A[2]-A[0]>1{
			ans += (A[2]-A[0])/2+2
		}else{
			ans++
		}
	}
	fmt.Println(ans)
}


// minをmaxにして残ったのをなんとかする
// なぜか2WA 意味不明 [0 1 1] -> [1 1 2] で[3 3 3]にしてしまっていたっぽい
// なんでふたつまえの提出でWAをくらったのかまるで理解できない たぶんジャッジがバグってるよ
package main
import (
	"fmt"
	"sort"
)
func main(){
	A := make([]int, 3)
	for i:=0; i<3; i++{
		fmt.Scan(&A[i])
	}
	sort.Ints(A)
	minimum, maximum := A[0], A[2]
	ans := 0
	if (maximum-minimum)%2 == 0{
		// ひたすら2だけやる
		ans += (maximum-minimum)/2
		A[0] = A[2]
	}else{
		// 1回だけ1をまぜる そのときA[1]にも加算
		ans += (maximum-minimum)/2 + 1
		A[0] = A[2]
		A[1]++
	}
	sort.Ints(A)
	if A[0]==A[1] && A[1] == A[2]{
		fmt.Println(ans)
	}else{
		if (A[2]-A[0]) % 2 == 1{
			if A[2]-A[0] == 1{
				fmt.Println(ans+1)
				return
			}else{
				A[1]++
				A[2]++
				ans++
			}
		}
		ans += (A[2] - A[0])/2
		fmt.Println(ans)
	}
}


a = gets.split.map(&:to_i).sort
count = 0
while a[-1] != a[-2]
  a[0] += 1
  a[1] += 1
  count += 1
end
while a[-2] > a[0]
  a[0] += 2
  count += 1
end
if a[-2] != a[0]
  count += 1
end
puts count


#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,B,C=get_i.sort{|x,y| y<=>x}
dif1=A-C
dif2=A-B
if (dif1+dif2).even?
  puts (dif1+dif2)/2
else
  puts (dif1+dif2+1)/2+1
end


A,B,C=gets.split.map(&:to_i)
ary = [A,B,C].sort
x, y, z = ary
cnt = 0
while x < z do
    if y < z
        x += 1
        y += 1
    else
        x += 2
    end
    cnt += 1
end
cnt += 1 if x > z || y > z
puts cnt


a,b,c = gets.strip.split.map(&:to_i)
d = [a,b,c].sort
s = d[2]-d[0]
t = d[2]-d[1]
u = d[1]-d[0]
if u%2==0
  puts u/2+t
else
  puts 2*u+t
end


#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,B,C=get_i
ab=(A-B).abs
bc=(B-C).abs
if (ab+bc).even?
    puts (ab+bc)/2
else
    puts (ab+bc+1)/2+1
end


ans = 0
x = gets.split.map(&:to_i).sort
loop do
  if x[1] - x[0] > 1
    x[0] += 2
  else
    x[0] += 1
    x[1] += 1
  end
  ans += 1
  break if x[0] == x[1] && x[1] == x[2]

  x.sort!
end
puts ans


use std::fmt::Debug;
use std::str::FromStr;

#[allow(dead_code)]
#[allow(deprecated)]
fn read_line_from_stdin() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer.trim_right().to_owned()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_single<T>() -> T
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    T::from_str(buffer.trim_right()).unwrap()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_multiple<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer
        .trim_right()
        .split_whitespace()
        .flat_map(|s| T::from_str(s))
        .collect()
}

#[allow(unused_macros)]
macro_rules! parse_line {
    [$( $x:tt : $t:ty ),+] => {
        //declare variables
        $( let $x: $t; )+
        {
            use std::str::FromStr;
            // read
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            #[allow(deprecated)]
            let mut splits = buf.trim_right().split_whitespace();
            // assign each variable
            $(
                $x = splits.next().and_then(|s| <$t>::from_str(s).ok()).unwrap();
            )+
            // all strs should be used for assignment
            assert!(splits.next().is_none());
        }
    };
}

struct State {
    a: i32,
    b: i32,
    c: i32,
}

fn main() {
    let mut inputs = parse_line_to_multiple::<i32>();
    inputs.sort();

    let mut operation_count = 0;

    while inputs[1] != inputs[2] {
        inputs[0] += 1;
        inputs[1] += 1;
        operation_count += 1;
    }

    while inputs[0] < inputs[1] {
        inputs[0] += 2;
        operation_count += 1;
    }

    if inputs[0] > inputs[1] {
        inputs[1] += 1;
        inputs[2] += 1;
        operation_count += 1;
    }

    assert_eq!(inputs[0], inputs[1]);
    assert_eq!(inputs[1], inputs[2]);

    println!("{}", operation_count);
}


use std::cmp::max;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
    a: usize,
    b: usize,
    c: usize,
    }
    let m = max(max(a, b), max(b, c));
    let l = 3 * m - (a + b + c);
    let ans = if l % 2 == 0 {l / 2}  else {l / 2 + 2};
    println!("{}", ans);
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn f(src: i64, dst: i64) -> i64 {
    if src > dst {
        return src - dst;
    }
    if (dst - src) % 2 == 0{
        return (dst - src) / 2;
    }
    (dst - src) / 2 +2
}

fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
    };
    println!(
        "{}",
        (-1..51)
        .map(|v| f(a, v) + f(b, v) + f(c, v))
        .min().unwrap()
    );
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {a: [usize; 3]};
    let mut a: Vec<usize> = a;

    a.sort();

    let mut count = a[2] - a[1];
    a[0] += count;
    count += (a[2] - a[0]) / 2;
    println!("{}", count)
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {a: [usize; 3]};
    let mut a: Vec<usize> = a;

    a.sort();

    let mut count = a[2] - a[1];
    a[0] += count;
    count = (a[2] -a[0]) / 2;
    // while a[0] != a[1] && a[1] != a[2] {
    //     if a[1] == a[2] {
    //         a[0] += 2;
    //         count += 1;
    //     } else {
    //         a[0] += 1;
    //         a[1] += 1;
    //         count += 1;
    //     }
    // }

    println!("{}", count)
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {a: [usize; 3]};
    let mut a: Vec<usize> = a;

    a.sort();

    let mut count = 0;
    while a[0] != a[1] || a[1] != a[2] {
        if a[1] == a[2] {
            a[0] += 2;
            count += 1;
        } else {
            a[0] += 1;
            a[1] += 1;
            count += 1;
        }
    }

    println!("{}", count)
}


let ABC = readLine()!.characters.split(" ").map{Int(String($0))!}
let max = ABC.maxElement()!
let sum = ABC.reduce(0){max+$0-$1}
print(sum%2>0 ?sum/2+2:sum/2)


let x=readLine()!.characters.split(" ").map{Int(String($0))!}.sort(),y=2*x[2]-x[0]-x[1];print(y/2+(y%2>0 ?2:0))


let ABC = readLine()!.characters.split(" ").map{Int(String($0))!}.sort()
let sum = 2*ABC[2]-ABC[0]-ABC[1]
print(sum/2+(sum%2>0 ?2:0))


let ABC = readLine()!.chracters.split(" ").map{Int(String($0))!}
let max = ABC.maxElement()!
let sum = ABC.reduce(0){max+$0-$1}
print(sum%2>0 ?sum/2+2:sum/2)


function main(input) {
  const [a, b, c] = input.trim().split(" ").map(n => Number(n));
  const max = Math.max(...[a, b, c]);
  let target = max;
  if (3*max % 2 !== (a+b+c)%2) {
    target++;
  }
  const result = (target*3 - (a+b+c))/2;
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [a, b, c] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const s = [a, b, c].sort((a, b) => b - a)

const max = s[0]

const diff = s[0] - s[1] + s[0] - s[2]

const res = _ => {
  let count = Math.ceil(diff / 2)

  if (diff % 2 !== 0) count++

  return count
}

console.log(res())


"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
let inputNum = input.map(mp => +mp);
inputNum.sort((a,b) => b - a);
const diff1 = inputNum[0] - inputNum[1];
let changedMin = inputNum[2] + diff1;
const diff2  = Math.ceil((inputNum[0] - changedMin)/2);
const diff3 = inputNum[2] + diff1 + (diff2*2) === inputNum[0] ? 0 : 1;
console.log(diff1 + diff2 + diff3);


function main(input) {
  const [a, b, c] = input.trim().map(n => Number(n));
  const max = Math.max(...[a, b, c]);
  let target = max;
  if (3*max % 2 !== (a+b+c)%2) {
    target++;
  }
  const result = (target*3 - (a+b+c))/2;
  console.log(reuslt);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
    input = input.split(' ');
    let A = Number(input[0]);
    let B = Number(input[1]);
    let C = Number(input[2]);

    let ans = 0;

    while (!(A == B && B == C)) {
        const max = Math.max(A, B, C);
        const ave = (A + B + C) / 3;

        if (Math.abs(max - ave) < 1.4) {
            switch (max) {
                case A:
                    B++; C++;
                    break;
                case B:
                    A++; C++;
                    break;
                case C:
                    A++; B++;
                    break;
            }
            ans++;
        }
        else {
            const min = Math.min(A, B, C);
            switch (min) {
                case A:
                    A += 2;
                    break;
                case B:
                    B += 2;
                    break;
                case C:
                    C += 2;
                    break;
            }
            ans++;
        }
    }
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
    input = input.split(' ');
    let A = Number(input[0]);
    let B = Number(input[1]);
    let C = Number(input[2]);

    let ans = 0;

    while (!(A == B && B == C)) {
        const max = Math.max(A, B, C);
        const ave = (A + B + C) / 3;

        if (Math.abs(max - ave) < 1.5) {
            switch (max) {
                case A:
                    B++; C++;
                    break;
                case B:
                    A++; C++;
                    break;
                case C:
                    A++; B++;
                    break;
            }
            ans++;
        }
        else {
            const min = Math.min(A, B, C);
            switch (min) {
                case A:
                    A += 2;
                    break;
                case B:
                    B += 2;
                    break;
                case C:
                    C += 2;
                    break;
            }
            ans++;
        }
    }
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


x = int(input())
if x == 1:
    ans = 0
else:
    ans = 1
print(ans)


x = int(input())
if x == 1:
    print(0)
else:
    print(1)


x = int(input())

result = 0 if x == 1 else 1

print(result)


x = int(input())
if x == 0:
  print(1)
elif x == 1:
  print(0)
else:
  break


x = int(input())
print(0 if x == 1 else 0)


import sys

a = sys.argv[1]

print(f'{1 - a}')


import java.io.*;
public class Main
{
  public static void main(String args[])throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    if(n==0)
      System.out.println("1");
    else
      System.out.println("0");
  }
}


/*****Author: Satyajeet Singh************************************/
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.lang.*;
    import java.math.*;
public class Main{
/*********************************************Constants******************************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins***************************************/

    public static void main(String args[]) throws Exception{
        int tt=pi();
        int ans=0;
        if(tt==0)ans=1;
        out.println(ans);
/****************************************Solution Ends**************************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing**********************************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000");
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation**************************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph*********************************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }
/*********************************************PAIR********************************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair*******************************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG***********************************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION***********************************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD**********************************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y;
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
}


import java.util.*;
import java.io.*;

public class Main{
    static long abs(long x){
        return Math.abs(x);
    }
    public static void main(String [] args) throws IOException{
        FastScanner sc=new FastScanner();
        int n=sc.nextInt();
        System.out.println(n==0?1:0);

    }
}

class FastScanner{
    private int BUFFER_SIZE = 1 << 16;

   private  DataInputStream din;

   private  byte[] buffer;

   private int bufferPointer, bytesRead;

   public FastScanner() {
       din = new DataInputStream(System.in);
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public FastScanner( String file_name) throws IOException {
       din = new DataInputStream(new FileInputStream(file_name));
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public String readLine() throws IOException {
        byte[] buf = new byte[64];
       int cnt = 0, c;
       while ((c = read()) != -1) {
           if (c == '\n')
               break;
           buf[cnt++] = (byte) c;
       }
       return new String(buf, 0, cnt);
   }

   public String next() throws IOException{

       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }

        StringBuilder builder = new StringBuilder();
       builder.append((char)c);
       c = read();
       while(!Character.isWhitespace(c)){
           builder.append((char)c);
           c = read();
       }

       return builder.toString();
   }

   public int nextInt() throws IOException {
       int ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (neg)
           return -ret;
       return ret;
   }

   public int[] nextIntArray( int n) throws IOException {
        int arr[] = new int[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextInt();
       }
       return arr;
   }

   public long nextLong() throws IOException {
       long ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');
       if (neg)
           return -ret;
       return ret;
   }

   public long[] nextLongArray( int n) throws IOException {
        long arr[] = new long[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextLong();
       }
       return arr;
   }

   public char nextChar() throws IOException{
       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }
       return (char) c;
   }

   public double nextDouble() throws IOException {
       double ret = 0, div = 1;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();

       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (c == '.') {
           while ((c = read()) >= '0' && c <= '9') {
               ret += (c - '0') / (div *= 10);
           }
       }

       if (neg)
           return -ret;
       return ret;
   }

   public double[] nextDoubleArray( int n) throws IOException {
        double arr[] = new double[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextDouble();
       }
       return arr;
   }

   private void fillBuffer() throws IOException {
       bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
       if (bytesRead == -1)
           buffer[0] = -1;
   }

   private byte read() throws IOException {
       if (bufferPointer == bytesRead)
           fillBuffer();
       return buffer[bufferPointer++];
   }

   public void close() throws IOException {
       if (din == null)
           return;
       din.close();
   }

}


import java.util.Scanner;

public class ProductMax {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextInt();
        long b = scan.nextInt();
        long c = scan.nextInt();
        long d = scan.nextInt();
        scan.close();
        long max = a * c;

        max = Math.max(max, a * d);
        max = Math.max(max, b * c);
        max = Math.max(max, b * d);

        System.out.println(max);
    }

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();
        scan.close();
        int max = a * c;
        for(int i = a; i <= b; i++){
            for(int j = c; j <= d; j++){
                if(i*j > max){
                    max = i*j;
                }
            }
        }
        System.out.println(max);
    }

}


import java.util.*;

public class Main {
    public void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        sc.close();
        if (x != 1) {
            System.out.println(0);
        } else if (x == 1) {
            System.out.println(1);
        }
    }

}


#include<stdio.h>
int main()
{
	int x;
	scanf("%d",&x);
	if(x==0)printf("1");
	else printf("0");
}


#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  cout<<(!n)<<'\n';
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    cout << 1 - n;
    return 0;
}


#include <iostream>

int i;
cin >> i;
if (i == 0) {
    count << "1";
} else {
    count << "0";
}


#include <bits/stdc++.h>

#include <atcoder/all>

// #LIB#

using namespace std;
using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll x;
  cin >> x;
  cout << !x << endl;
}


#include <stdio.h>

int main(){
  int a;
  scanf("%d",&a);
  if(a==1) puts("0");
  else puts("1");
}


#include <stdio.h>

int main ()
{
	int n;

	scanf ("%d", &n);

	if (n == 0) printf ("1");
	if (n == 1) printf ("0");

	return 0;
}


#include<stdio.h>

int main ()
{
    int x;

    scanf("%d",&x);

    if(x==1)
        printf("0");

    else if(x==0)
        printf("1");

    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define ll long long
int main() {
	int x; cin >> x;
	if (x == 0) {
		cout << "1" << endl;
	}
	else {
		cout << "0" << endl;
	}
	return 0;
}


#include <stdio.h>

int main(int argc, char *argv[])
{
int a;
int b;
int c;
int d;
int max;
int ret;
/* a<= x <= b, c<=y<=d */
ret=scanf("%d %d %d %d", &a,&b,&c,&d);

max = a*c;
if(max < a*d) max=a*d;
if(max < b*c) max=b*c;
if(max < b*d) max=b*d;
printf("%d", max);

}


#include <stdio.h>

int main(int argc, char *argv[])
{
int x;
scanf("%d", &x);
if(x==0) printf("1");
else print("0");
}


function Main(input){
if(parseInt(input) === 1){
  console.log(0)
}
else if (parseInt(input) === 0){
  console.log(1)
}
else {console.log(null)}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use script';

{
function Main(input) {

	const x = parseInt(input[0], 10);
  	let y = Math.abs(x-1);

	console.log(y);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

}


function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");

    let x = Number(input[0]);
    if(x) console.log(0);
    else console.log(1);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  const out = input == '0'? '1' : '0';
  console.log(out);
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use script';

{
function Main(input) {
	//input = input.split("\n");
	tmp = input.split(" ");
	const a = parseInt(tmp[0], 10);
	const b = parseInt(tmp[1], 10);
	const c = parseInt(tmp[2], 10);
	const d = parseInt(tmp[3], 10);

  	let max = a*c;

	if(max < a*d){
      max = a*d;
    }
	if(max < b*c){
      max = b*c;
    }
  	if(max < b*d){
      max = b*d;
    }

  	console.log(max);

	}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

}


function main(input) {
  const x = parseInt(input);
  // この下の行から
  if(x=0){console.log("1");}else if(x=1){
    console.log("0");}

  // この上の行まででプログラムを書く
};
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)

	if x == 1 {
		fmt.Println(0)
	} else {
		fmt.Println(1)
	}
}


package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	if x == 0 {
		x = 1
	} else {
		x = 0
	}
	fmt.Println(x)
}


package main

import (
	"fmt"
)

func main() {
	var x int
	fmt.Scan(&x)

	if x == 1 {
		fmt.Println(0)

		return
	}
	fmt.Println(1)

}


var a int
fmt.Scan(&a)

if a == 0 {
  fmt.Println(1)
} else if a == 1 {
  fmt.Println(0)
} else {

}


package main

import "fmt"

func main() {
	var a int
	fmt.Scan(a)
	if a == 1 {
		fmt.Println("0")
	} else if a == 0 {
		fmt.Println("1")
	}

}


package main

import "fmt"

func main() {
	var a int
	fmt.Scan(a)
	if a == 1 {
		fmt.Println("0")
	} else {
		fmt.Println("1")
	}

}


I = gets.to_i

puts I == 1 ? 0 : 1


x = gets.to_i

if x == 0
  puts 1
elsif x == 1
  puts 0
end


x = gets.to_i
puts 1 - x


n = gets.to_i

mod = 10**9 + 7

ans = 10.pow(n, mod)
ans -= 9.pow(n, mod) * 2
ans += 8.pow(n, mod)
puts ans % mod


n = gets.to_i

mod = 10**9 + 7

ans = 10.pow(n, mod)
ans -= 9.pow(n, mod) * 2
ans += 8.pow(n, mod)
puts ans / mod


std = gets
if std == 0 then
  printf("1")
elseif std == 1 then
 printf("0")
end


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {x: usize};

    if x == 1 {
        println!("0")
    } else {
        println!("1")
    }
}


#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        x: i32,
    }

    let ans = if x == 0 { 1 } else { 0 };
    println!("{}", ans);
}


use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

fn main() {
    input! {
        x: usize
    }
    if x == 1 {
        println!("0");
        return;
    }
    println!("1");
}


use std :: io ;
fn main(){
 loop{
    let mut no = String::new();

  io :: stdin()
    .read_line(&mut no)
    .expect("failed to read line ");

 let no : i32 = no.trim().parse().expect("error!");

if no == 0 {
    println!("1");
 } else if no == 1 {
        println!("0");
    }else {
        println!("...");
    }
}
}


use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (n, m, l, k) = (it.next().unwrap(), it.next().unwrap(),
        it.next().unwrap(), it.next().unwrap());
    let mut v = Vec::new();
    v.push(n * l);
  v.push(n * k);
  v.push(m * l);
  v.push(m * k);
  if let Some(num) = v.iter().max() {
    	println!("{}", num);
  }
}


print(readLine()! == "0" ? "1" : "0")


let x = readLine()!
print(x == "0" ? "1" : "0")


func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainA() {
    let x = readInt()
    print(x == 0 ? 1 : 0)
}
mainA()


let n = Int(readLine()!)!
let devider = 1000_000_000 + 7

func powerOfTwo(num: Int, multiply: Int) -> Int {
    var result = 1
    for _ in 0..<num {
        result = (result * multiply) % devider
    }
    return result
}

let universe = powerOfTwo(num: n, multiply: 10)
let nWithoutZero = powerOfTwo(num: n, multiply: 9)
let nWithoutNine = powerOfTwo(num: n, multiply: 9)
let nWIthoutZeroAndNine = powerOfTwo(num: n, multiply: 8)

if n == 1 {
    print(0)
} else {
    let ans = (universe - nWithoutZero - nWithoutNine + nWIthoutZeroAndNine) % devider
    print(ans > 0 ? ans : (ans+devider) % devider)
}


let n = Int(readLine()!)!
let devider = 1000_000_000 + 7

func powerOfTwo(num: Int, multiply: Int) -> Int {
    var result = 1
    for _ in 0..<num {
        result = (result * multiply) % devider
    }
    return result
}

let universe = powerOfTwo(num: n, multiply: 10)
let nWithoutZero = powerOfTwo(num: n, multiply: 9)
let nWithoutNine = powerOfTwo(num: n, multiply: 9)
let nWIthoutZeroAndNine = powerOfTwo(num: n, multiply: 8)

if n == 1 {
    print(0)
} else {
    var ans = (universe - nWithoutZero - nWithoutNine + nWIthoutZeroAndNine) % devider
    ans = (ans + devider) % devider
    print(ans)
}


let n = Int(readLine()!)!
let devider = 1000_000_000 + 7

func powerOfTwo(num: Int, multiply: Int) -> Int {
    var result = 1
    for _ in 0..<num {
        result = (result * multiply) % devider
    }
    return result
}

let universe = powerOfTwo(num: n, multiply: 10)
let nWithoutZero = powerOfTwo(num: n, multiply: 9)
let nWithoutNine = powerOfTwo(num: n, multiply: 9)
let nWIthoutZeroAndNine = powerOfTwo(num: n, multiply: 8)

if n == 1 {
    print(0)
} else {
    var ans = universe - nWithoutZero - nWithoutNine + nWIthoutZeroAndNine % devider
    ans = (ans + devider) % devider
    print(ans)
}


import { readFileSync } from "fs";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tuple = <T extends unknown[]>(...ts: T) => ts;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [cin, nCin, bCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]+/);
  let count = 0;
  const cin = () => inputs[count++];
  return tuple(
    cin,
    () => Number(cin()),
    () => BigInt(cin())
  );
})();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isNumber = (x: unknown): x is number => typeof x === "number";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isBigint = (x: unknown): x is bigint => typeof x === "bigint";
type NumberOrBigintOrElse<T> = number | bigint extends T
  ? undefined
  : T extends number
  ? number
  : T extends bigint
  ? bigint
  : undefined;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const max = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.max(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc >= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const min = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.min(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc <= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const abs = <T extends number | bigint>(t: T) =>
  (isNumber(t)
    ? Math.abs(t)
    : isBigint(t)
    ? t >= 0n
      ? t
      : -t
    : undefined) as NumberOrBigintOrElse<T>;

/**
 * Program
 */
const getAns = (n: number): number => (n === 0 ? 1 : 0);

{
  const x = nCin();
  const ans = getAns(x);
  console.log(ans);
}


"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\n/);

console.log(input[0] === '1' ? '0' : '1');


var main = (input: string) => {
    if (input.trim() === '0') {
        console.log('1');
    } else {
        console.log('0');
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


const isZero = (x: number) => x === 0 ? x : 1;

const  main = (standardInput) => {
  const  lengthList: string[] = standardInput.split(' ');
  const x: number = Number.parseInt(lengthList[0]);
  console.log(isZero(x))

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));


const someNumber: number = Math.random(0,1)

if(number === 0) {
  console.log(1)
} else if (number === 1) {
  console.log(0)
}


var main = (input: string) => {
    if (input === '0') {
        console.log('1');
    } else {
        console.log('0');
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-2):
  target = p[i:i+3]
  target_s = sorted(target)
  if  target_s[1]== target[1]:
    count += 1
print(count)


n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
    t = p[i: i + 3]
    t.sort()
    if t.index(p[i + 1]) == 1:
        ans += 1
print(ans)


n=int(input())
p=list(map(int, input().split()))
cnt=0
for i in range (n):
    if i == 0:
        continue
    if i == n - 1:
        break
    if p[i-1] <= p[i] and p[i] <= p[i+1] or p[i+1] <= p[i] and p[i] <= p[i-1]:
        cnt+=1

print(cnt)


n = int(input())
p = list(map(int, input().split()))
s = 0
for i in range(n - 1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
        s += 1
print(s)


permutation_number = int(input())
permutation_value = list(map(int, input().split()))
condition_permutation = 0
for i in range(permutation_number - 1):
    if permutation_value[i - 1] < permutation_value[i] < permutation_value[i + 1] or permutation_value[i - 1] > permutation_value[i] > permutation_value[i + 1]:
        condition_permutation += 1
print(condition_permutation)


#ABC132 B

n = int(input())
K = 0
for i in range(n-2):
    if (P[i]<P[i+1] and P[i+1] < P[i+2]) or (P[i+2]<P[i+1] and P[i+1]<P[i]):
        K += 1

print(K)


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int n = sc.nextInt();
		int[] ary = new int[n];
		for (int i = 0; i < n; i++) {
			ary[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < n - 2; i++) {
			int p1 = ary[i];
			int p2 = ary[i + 1];
			int p3 = ary[i + 2];
			if ((p1 < p2 && p2 < p3) || (p3 < p2 && p2 < p1)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}