def ii() gets.chomp.to_i end def li() gets.chomp.split.map(&:to_i) end a=li() ans=0 for x in a if x%15==0 ans+=8 elsif x%5==0||x%3==0 ans+=4 else ans+=x.to_s.size end end puts ans