#include using namespace std; int n, m; bool links[51][51] = { false }; int nodes[4]; int count(int node, int remaining) { nodes[remaining] = node; if (remaining == 0) { bool closed = true; for (int i = 0; i < 4; ++i) { int linkCount = 0; for (int k = 0; k < 4; ++k) { if (links[nodes[i]][nodes[k]]) { ++linkCount; } } if (linkCount != 2) { closed = false; break; } } return closed ? 1 : 0; } int result = 0; for (int i = node + 1; i < n; ++i) { result += count(i, remaining - 1); } return result; } int main(int argc, const char * argv[]) { cin >> n >> m; for (int i = 0; i < m; ++i) { int a, b; cin >> a >> b; links[a][b] = true; links[b][a] = true; } int result = 0; for (int i = 0; i < n; ++i) { result += count(i, 3); } cout << result << endl; return 0; }