import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    auto nm=readln.split.map!(to!int).array;
    auto n=nm[0];
    auto m=nm[1];
    int[][] abs;
    foreach(i;0..m)abs~=readln.split.map!(to!int).array;
    int[][] routes;
    routes~=[1];
    foreach(i;0..n-1){
        int[][] newRoutes;
        foreach(x;1..n+1){
            foreach(r;routes){
                if(r.find(x).empty)newRoutes~=(r~x);
            }
        }
        routes=newRoutes;
    }
    long res=0;
outer:foreach(r;routes){
          foreach(i;0..n-1){
            if(abs.find(r[i..i+2]).empty && abs.find([r[i+1],r[i]]).empty)continue outer;
          }
          ++res;
    }
      writeln(res);
}
