def main():

    N, M = (int(i) for i in input().split())

    edge = [set() for _ in range(N)]

    for i in range(M):

        a, b = (int(i) for i in input().split())

        edge[a-1].add(b-1)

        edge[b-1].add(a-1)

    from itertools import permutations

    ans = 0

    for p in permutations(list(range(1, N))):

        u = 0

        for v in p:

            if v not in edge[u]:

                break

            u = v

        else:

            ans += 1

    print(ans)





if __name__ == '__main__':

    main()

def main():

    import sys

    input = sys.stdin.buffer.readline

    from itertools import permutations

    N, M = (int(i) for i in input().split())

    edge = [[] for _ in range(N)]

    for i in range(M):

        a, b = (int(i) for i in input().split())

        edge[a-1].append(b-1)

        edge[b-1].append(a-1)



    ans = 0

    for p in permutations(list(range(1, N))):

        v = 0

        for nv in p:

            if nv in edge[v]:

                v = nv

            else:

                break

        else:

            ans += 1

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N, M = (int(i) for i in input().split())
    edge = [set() for _ in range(N)]
    for i in range(M):
        a, b = (int(i) for i in input().split())
        edge[a - 1].add(b - 1)
        edge[b - 1].add(a - 1)
    from itertools import permutations

    ans = 0
    for p in permutations(list(range(1, N))):
        u = 0
        for v in p:
            if v not in edge[u]:
                break
            u = v
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

def main():
    import sys

    input = sys.stdin.buffer.readline
    from itertools import permutations

    N, M = (int(i) for i in input().split())
    edge = [[] for _ in range(N)]
    for i in range(M):
        a, b = (int(i) for i in input().split())
        edge[a - 1].append(b - 1)
        edge[b - 1].append(a - 1)
    ans = 0
    for p in permutations(list(range(1, N))):
        v = 0
        for nv in p:
            if nv in edge[v]:
                v = nv
            else:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

+    import sys + +    input = sys.stdin.buffer.readline +    from itertools import permutations + -    edge = [set() for _ in range(N)] +    edge = [[] for _ in range(N)] -        edge[a - 1].add(b - 1) -        edge[b - 1].add(a - 1) -    from itertools import permutations - +        edge[a - 1].append(b - 1) +        edge[b - 1].append(a - 1) -        u = 0 -        for v in p: -            if v not in edge[u]: +        v = 0 +        for nv in p: +            if nv in edge[v]: +                v = nv +            else: -            u = v