import qualified Data.ByteString.Char8 as B
import qualified Data.IntSet as S
import Data.Array.IArray
import Data.Maybe
import Data.Monoid
 
type Vertex = Int
type Vertexes = S.IntSet
type Edge = (Vertex, Vertex)
type Graph = Array Vertex Vertexes

instance Monoid Int where
  mempty = 0
  mappend = (+)

buildG :: Int -> [Edge] -> Graph
buildG n = accumArray (flip S.insert) S.empty (1, n)
 
from :: Graph -> Vertex -> Vertexes
from g = (g !)
 
readUndirectedEdge :: B.ByteString -> [Edge]
readUndirectedEdge = concatMap ((\[v,w] -> [(v,w),(w,v)]) . map readVertex . B.words) . B.lines
 
readVertex :: B.ByteString -> Vertex
readVertex = fst . fromJust . B.readInt

main :: IO ()
main = do
 [n,_] <- map read . words <$> getLine
 es <- readUndirectedEdge <$> B.getContents
 let g = buildG n es
 print (dfs g (const 1) 1 :: Int)
 
dfs :: Monoid m => Graph -> (Vertexes -> m) -> Vertex -> m
dfs g p v = dfsCore g p v visited mempty
  where
    visited = S.empty

dfsCore :: Monoid m => Graph -> (Vertexes -> m) -> Vertex -> Vertexes -> m -> m
dfsCore g p v visited m
  | S.null next = p visited <> m
  | otherwise = S.foldr (\w acc -> dfsCore g p w (S.insert v visited) m) mempty next
  where
    next = S.difference (from g v) visited