import Data.Array.Unboxed
import Data.List

main = do
  n <- readLn
  as <- map read . words <$> getLine
  print (together n as)

together :: Int -> [Int] -> Int
together 1 _ = 1
together n as = nsum 2 das + 2
  where
    sas = sort as
    das = buildA $ zipWith (-) (tail sas) sas


type Index = Int

-- 1-indexed
buildA :: IArray a e => [e] -> a Index e
buildA xs = listArray (1, length xs) xs

nsum :: Int -> Array Index Int -> Int
nsum x arr = go 1 1 (arr ! 1)
  where
    (_, l) = bounds arr
    go i j acc
      | i == l && j == l = (if acc == x then 1 else 0)
      | i == j = max (if acc == x then 1 else 0) (go i (j + 1) (acc + arr ! (j + 1)))
      | j == l = max (if acc == x then (j-i) else 0) (go (i + 1) j (acc - arr ! i))
      | acc == x = max (j-i) (go i (j + 1) (acc + arr ! (j + 1)))
      | acc < x = go i (j + 1) (acc + arr ! (j + 1))
      | acc > x = go (i + 1) j (acc - arr ! i)
      | otherwise = error "nsum: Pattern match failed."