#include using namespace std; using Gragh = vector>; const long long INF = (1<<25) - 1; int main(){ int n, m; cin >> n >> m; Gragh G(n); for (int i = 0; i < m; ++i){ int a, b; cin >> a >> b; --a; --b; G[a].insert(b); G[b].insert(a); } vector> dist(n, vector(n, INF)); for (int i = 0; i < n; ++i){ for (int j = 0; j < n; ++j){ if (i == j) dist[i][i] = 0; else if (G[j].find(i) != G[j].end()){ dist[i][j] = 1; dist[j][i] = 1; } } } for (int k = 0; k < n; ++k){ for (int i = 0; i < n; ++i){ for (int j = 0; j < n; ++j){ dist[i][j] = min(dist[i][k] + dist[k][j],dist[i][j]); } } } int res = 0; for (int i = 0; i < n; ++i){ for (int j = i + 1; j < n; ++j){ for (int k = j + 1; k < n; ++k){ if ((dist[i][j] >= 3 || dist[i][j] == 1 ) && (dist[j][k] >= 3 || dist[j][k] == 1) && (dist[k][i] >= 3 || dist[k][i] == 1)) ++res; } } } cout << res << endl; }