#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; vector Graph(n, vector(n, false)); rep(_, m) { int u, v; cin >> u >> v; Graph[u][v] = Graph[v][u] = true; } set> ans, mans; rep(u, n) rep(v, n) rep(w, n) { if (u == v || u == w || v == w) continue; if (!Graph[u][v] || !Graph[v][w]) continue; bool flg = false; if (Graph[u][v] && Graph[v][w] && Graph[w][u]) flg = true; rep(x, n) { if (x == u || x == v || x == w) continue; if (Graph[w][x] && Graph[x][u]) { vector cycle = { u, v, w, x }; sort(cycle.begin(), cycle.end()); ans.insert(cycle); if (flg) mans.insert(cycle); } } } for (auto& c : mans) ans.erase(c); cout << ans.size() << '\n'; return 0; }