#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int,int>
#define pb push_back

using namespace std ;

const int N = 410, M = 1e5 + 10;

bool c[N][N], bad[N];
pii e[M];

int32_t main() {
    ios_base::sync_with_stdio(0);
	int n, m; cin >> n >> m;
	for(int i=0; i<m; i++){
		int u, v; cin >> u >> v;
		e[i] = {u, v};
	}
	
	for(int i=1; i<=n; i++){
		c[i][i] = 1;
		for(int j=m-1; j>=0; j--){
			int u = e[j].F, v = e[j].S;
			if(c[i][u] && c[i][v]){
				bad[i] = true;
			}else if(!c[i][u] && !c[i][v])continue;
			else if(c[i][u] && !c[i][v])c[i][v] = true;
			else c[i][u] = true;
		}
	}

	int ans = 0;

	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++){
			if(bad[i] || bad[j])continue;
			if(c[i][j] || c[j][i])continue;
			bool no = false;
			for(int k=1; k<=n; k++)
				if(c[i][k] && c[j][k])no = true;
			if(!no)ans++;
		}

	cout << ans << endl;

}
