h={4=>3,6=>5,12=>11,14=>13,18=>8,20=>19,21=>19,24=>23,25=>23};h.default=7 n=gets.to_i p n<26 ? h[n] : N%8==1&&`factor #{N-8}`.count(' ')<2 ? 14 : 8