import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main(){
  auto s1s2s3=readln.chomp.to!int;
  if(s1s2s3==100||s1s2s3==010||s1s2s3==001)writeln(1);
  else if(s1s2s3==110||s1s2s3==101||s1s2s3==011)writeln(2);
  else if(s1s2s3==111)writeln(3);
  else writeln(0);
}