import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<(B.getLine>>B.getLine)
solve=g=<<foldr f(0,0,0)
f a(i,j,k)
  |a<0=(i+1,j,k)
  |a>0=(i,j,k+1)
  |otherwise=(i,j+1,k)
g(i,j,k)as
  |even i || j>0=sum bs
  |otherwise=sum bs-minimum bs*2
  where bs=map abs as