1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define SZ(x) int((x).size())
#define DBG(v) cerr << #v << " = " << (v) << endl;
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define fi first
#define se second

const int N = 500500;

int a[N], b[N], p[N];

int fin(int x) {
	return p[x]==x ? x : p[x]=fin(p[x]);
}

void uni(int x, int y) {
	p[fin(x)] = fin(y);
}

int main() {
	int n,m;
	scanf("%d%d", &n, &m);
	FOR(i,m) {
		scanf("%d%d", &a[i], &b[i]);
	}
	int res = 0;
	FOR(i,m) FOR(j,i) FOR(k,j) {
		FORI(u,n) p[u]=u;
		FOR(l,m) if (l!=i&&l!=j&&l!=k) uni(a[l], b[l]);
		int f = fin(n);
		FORI(u,n-1) if (fin(u) != f) {
			res++;
			break;
		}
	}
	printf("%d\n", res);
	return 0;
}