#include<cstdio>
#include<iostream>
using namespace std;
long long n,m;
long long map[21][21];
long long book[21];
long long ans;
long long jc(int k){
if(k==0) return 1;
long long num=1;
for(long long i=1;i<=k;i++)
num*=i;
return num;
}
long long dfs(long long s,long long k){
if(k==1) ans=0;
if(s==0) {ans++;return ans;}
if(k>n) return ans;
for(long long i=1;i<=n;i++)
if(map[k][i]==1 && book[i]==0)
book[i]=1,dfs(s-1,k+1),book[i]=0;
dfs(s,k+1);
return ans;
}
int main(){
freopen("arrange.in","r",stdin);
freopen("arrange.out","w",stdout);
long long x,y,i;
cin>>n>>m;
for(i=1;i<=m;i++)
cin>>x>>y,map[x][y]=1;
long long anss=0;
for(i=0;i<=n;i++){
if(i%2==0) anss+=(jc(n-i)*dfs(i,1));
if(i%2==1) anss-=(jc(n-i)*dfs(i,1));
}
cout<<anss;
}