import itertools



N,M=list(map(int,input().split()))

ab=[]

for i in range(M):

    a,b=list(map(int,input().split()))

    ab.append([a,b])



per=[i for i in range(2,N+1)]

permu=[]

for i in itertools.permutations(per):

    lst=[1]

    lst.extend(i)

    permu.append(lst)

num=0

for lst in permu:

    can=True

    for i in range(N-1):

        if not([lst[i],lst[i+1]] in ab) and not([lst[i+1],lst[i]] in ab):

            can=False

            break

    if can:

        num+=1

print(num)

from itertools import permutations

from heapq import *

from collections import defaultdict

from math import log

from itertools import accumulate

from collections import deque

#maxv=[0]

import sys

sys.setrecursionlimit(100100)



import math

from math import ceil

from copy import deepcopy





N,M=list(map(int,input().split()))

T=[[] for i in range(N)]

for i in range(M):

    u,v=list(map(int,input().split()))

    u,v=u-1,v-1

    T[u].append(v)

    T[v].append(u)

list=list(range(1,N))

ans=0

for l in permutations(list):

    t=True

    for i in range(N-1):

        if i==0:

            if not l[0] in T[0]:

                t=False

                break

        else:

            if not l[i] in T[l[i-1]]:

                t=False

                break

    if t:

        ans+=1

print(ans)

import itertools

N, M = list(map(int, input().split()))
ab = []
for i in range(M):
    a, b = list(map(int, input().split()))
    ab.append([a, b])
per = [i for i in range(2, N + 1)]
permu = []
for i in itertools.permutations(per):
    lst = [1]
    lst.extend(i)
    permu.append(lst)
num = 0
for lst in permu:
    can = True
    for i in range(N - 1):
        if not ([lst[i], lst[i + 1]] in ab) and not ([lst[i + 1], lst[i]] in ab):
            can = False
            break
    if can:
        num += 1
print(num)

from itertools import permutations
from heapq import *
from collections import defaultdict
from math import log
from itertools import accumulate
from collections import deque

# maxv=[0]
import sys

sys.setrecursionlimit(100100)
import math
from math import ceil
from copy import deepcopy

N, M = list(map(int, input().split()))
T = [[] for i in range(N)]
for i in range(M):
    u, v = list(map(int, input().split()))
    u, v = u - 1, v - 1
    T[u].append(v)
    T[v].append(u)
list = list(range(1, N))
ans = 0
for l in permutations(list):
    t = True
    for i in range(N - 1):
        if i == 0:
            if not l[0] in T[0]:
                t = False
                break
        else:
            if not l[i] in T[l[i - 1]]:
                t = False
                break
    if t:
        ans += 1
print(ans)

-import itertools +from itertools import permutations +from heapq import * +from collections import defaultdict +from math import log +from itertools import accumulate +from collections import deque + +# maxv=[0] +import sys + +sys.setrecursionlimit(100100) +import math +from math import ceil +from copy import deepcopy -ab = [] +T = [[] for i in range(N)] -    a, b = list(map(int, input().split())) -    ab.append([a, b]) -per = [i for i in range(2, N + 1)] -permu = [] -for i in itertools.permutations(per): -    lst = [1] -    lst.extend(i) -    permu.append(lst) -num = 0 -for lst in permu: -    can = True +    u, v = list(map(int, input().split())) +    u, v = u - 1, v - 1 +    T[u].append(v) +    T[v].append(u) +list = list(range(1, N)) +ans = 0 +for l in permutations(list): +    t = True -        if not ([lst[i], lst[i + 1]] in ab) and not ([lst[i + 1], lst[i]] in ab): -            can = False -            break -    if can: -        num += 1 -print(num) +        if i == 0: +            if not l[0] in T[0]: +                t = False +                break +        else: +            if not l[i] in T[l[i - 1]]: +                t = False +                break +    if t: +        ans += 1 +print(ans)