import qualified Data.ByteString.Char8 as C
import Data.IntSet hiding (foldl')
import Data.List hiding (delete, insert)

main = C.interact $ put . sol . tail . get
get = unfoldr (C.readInt . C.dropWhile (<'0'))
put = C.pack . show

sol = size . foldl' f empty

f s x = if x `member` s 
  then delete x s 
  else insert x s