def is_ok c1, c2, c3, lack if c1 == 0 then c1 = lack elsif c2 == 0 then c2 = lack else c3 = lack end return false if c1 == c2 or c2 == c3 or c3 == c1 [c1, c2, c3].max == c2 or [c1, c2, c3].min == c2 end c1, c2, c3 = gets.chomp.split.map &:to_i print 1 if is_ok c1, c2, c3, 1 print 4 if is_ok c1, c2, c3, 4 puts