#include using namespace std; using ll = long long; using Graph = vector>; const ll mod = 1000000007; const int INF = 1001001001; int main(){ int n, m; cin >> n >> m; Graph G(n, vector(n, INF)); for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; --a; --b; G[a][b] = 1; G[b][a] = 1; } for(int k = 0; k < n; k++){ for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ G[i][j] = min(G[i][j], G[i][k] + G[k][j]); } } } int ans = n * (n-1) * (n-2) / 6; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++){ for(int k = j+1; k < n; k++){ if(G[i][j] == 2 || G[j][k] == 2 || G[k][i] == 2) ans--; } } } cout << ans << endl; }