from itertools import permutations



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

g = [[0] * N for _ in range(N)]

for i in range(M):

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

    a -= 1

    b -= 1



    g[a][b] = 1

    g[b][a] = 1

# print(g)

check = set()



path = list(permutations(list(range(N))))



for t in path:

    if t[0] != 0:

        continue

    flag = True

    for i in range(N - 1):

        if g[t[i]][t[i + 1]] != 1:

            flag = False

            break

    if flag:

        check.add(t)



# print(check)

print((len(check)))

import sys

from collections import defaultdict



input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)





def main():



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

    G = defaultdict(lambda: [])



    for i in range(M):

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

        a -= 1

        b -= 1

        G[a].append(b)

        G[b].append(a)



    # print(G)



    def dfs(v, is_visited):

        if sum(is_visited) == N:

            return 1

        ans = 0

        for u in G[v]:

            if is_visited[u]:

                continue

            is_visited[u] = True

            ans += dfs(u, is_visited)

            is_visited[u] = False



        return ans



    is_visited = [False] * N

    is_visited[0] = True



    print((dfs(0, is_visited)))





if __name__ == "__main__":

    main()

from itertools import permutations

N, M = list(map(int, input().split()))
g = [[0] * N for _ in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    g[a][b] = 1
    g[b][a] = 1
# print(g)
check = set()
path = list(permutations(list(range(N))))
for t in path:
    if t[0] != 0:
        continue
    flag = True
    for i in range(N - 1):
        if g[t[i]][t[i + 1]] != 1:
            flag = False
            break
    if flag:
        check.add(t)
# print(check)
print((len(check)))

import sys
from collections import defaultdict

input = sys.stdin.readline
sys.setrecursionlimit(10**7)


def main():
    N, M = list(map(int, input().split()))
    G = defaultdict(lambda: [])
    for i in range(M):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        G[a].append(b)
        G[b].append(a)
    # print(G)
    def dfs(v, is_visited):
        if sum(is_visited) == N:
            return 1
        ans = 0
        for u in G[v]:
            if is_visited[u]:
                continue
            is_visited[u] = True
            ans += dfs(u, is_visited)
            is_visited[u] = False
        return ans

    is_visited = [False] * N
    is_visited[0] = True
    print((dfs(0, is_visited)))


if __name__ == "__main__":
    main()

-from itertools import permutations +import sys +from collections import defaultdict -N, M = list(map(int, input().split())) -g = [[0] * N for _ in range(N)] -for i in range(M): -    a, b = list(map(int, input().split())) -    a -= 1 -    b -= 1 -    g[a][b] = 1 -    g[b][a] = 1 -# print(g) -check = set() -path = list(permutations(list(range(N)))) -for t in path: -    if t[0] != 0: -        continue -    flag = True -    for i in range(N - 1): -        if g[t[i]][t[i + 1]] != 1: -            flag = False -            break -    if flag: -        check.add(t) -# print(check) -print((len(check))) +input = sys.stdin.readline +sys.setrecursionlimit(10**7) + + +def main(): +    N, M = list(map(int, input().split())) +    G = defaultdict(lambda: []) +    for i in range(M): +        a, b = list(map(int, input().split())) +        a -= 1 +        b -= 1 +        G[a].append(b) +        G[b].append(a) +    # print(G) +    def dfs(v, is_visited): +        if sum(is_visited) == N: +            return 1 +        ans = 0 +        for u in G[v]: +            if is_visited[u]: +                continue +            is_visited[u] = True +            ans += dfs(u, is_visited) +            is_visited[u] = False +        return ans + +    is_visited = [False] * N +    is_visited[0] = True +    print((dfs(0, is_visited))) + + +if __name__ == "__main__": +    main()