import sys

from scipy.sparse import csr_matrix

from scipy.sparse.csgraph import floyd_warshall



def solve(N: int, M: int, a: "List[int]", b: "List[int]"):

    answer = 0

    for i in range(M): ## iの辺を消す

        matrix = [[0]*(N) for _ in range(N)]

        for j in range(M):

            if j == i:

                continue

            aa = a[j]-1

            bb = b[j]-1

            matrix[aa][bb] = 1

           

        dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False)

        

        if dist_matrix[a[i]-1][b[i]-1] == float('inf'):

            answer += 1

            

    print(answer)

    return





def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    N = int(next(tokens))  # type: int

    M = int(next(tokens))  # type: int

    a = [int()] * (M)  # type: "List[int]"

    b = [int()] * (M)  # type: "List[int]"

    for i in range(M):

        a[i] = int(next(tokens))

        b[i] = int(next(tokens))

    solve(N, M, a, b)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3

import sys

input = sys.stdin.readline

def INT(): return int(eval(input()))

def MAP(): return list(map(int,input().split()))

def LI(): return list(map(int,input().split()))



class UnionFind():

    def __init__(self, n):

        self.n = n

        self.parents = [-1] * n

        

    def find(self, x): # 根を探す

        if self.parents[x] < 0:

            return x

        else:

            self.parents[x] = self.find(self.parents[x])

            return self.parents[x]

    

    def union(self, x, y):

        x = self.find(x)

        y = self.find(y)

        

        if x == y:

            return

        

        if self.parents[x] > self.parents[y]:

            x, y = y, x

        

        self.parents[x] += self.parents[y]

        self.parents[y] = x

    

    def size(self, x):

        return -self.parents[self.find(x)]

        

    def same(self, x, y):

        return self.find(x) == self.find(y)

    

    def members(self, x):

        root = self.find(x)

        return [i for i in range(self.n) if self.find(i) == root]

    

    def roots(self):

        return [i for i, x in enumerate(self.parents) if x < 0]



    def group_count(self):

        return len(self.roots())

    

    def all_group_members(self):

        return {r: self.members(r) for r in self.roots()}

    

    def __str__(self):

        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



def main():

    N,M=MAP()

    

    edges = []

    for _ in range(M):

        a,b = MAP()

        edges.append((a-1,b-1))



    answer = 0

    for i in range(M): # i番目の辺を使わない

        uf = UnionFind(N)



        for j in range(M):

            if i == j:

                continue



            a,b = edges[j]

            uf.union(a,b)

        if uf.group_count() > 1:

            answer += 1

    print(answer)

    return



if __name__ == '__main__':

    main()

import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    answer = 0
    for i in range(M):  ## iの辺を消す
        matrix = [[0] * (N) for _ in range(N)]
        for j in range(M):
            if j == i:
                continue
            aa = a[j] - 1
            bb = b[j] - 1
            matrix[aa][bb] = 1
        dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False)
        if dist_matrix[a[i] - 1][b[i] - 1] == float("inf"):
            answer += 1
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (M)  # type: "List[int]"
    b = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):  # 根を探す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots())


def main():
    N, M = MAP()
    edges = []
    for _ in range(M):
        a, b = MAP()
        edges.append((a - 1, b - 1))
    answer = 0
    for i in range(M):  # i番目の辺を使わない
        uf = UnionFind(N)
        for j in range(M):
            if i == j:
                continue
            a, b = edges[j]
            uf.union(a, b)
        if uf.group_count() > 1:
            answer += 1
    print(answer)
    return


if __name__ == "__main__":
    main()

+#!/usr/bin/env python3 -from scipy.sparse import csr_matrix -from scipy.sparse.csgraph import floyd_warshall + +input = sys.stdin.readline -def solve(N: int, M: int, a: "List[int]", b: "List[int]"): +def INT(): +    return int(eval(input())) + + +def MAP(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +class UnionFind: +    def __init__(self, n): +        self.n = n +        self.parents = [-1] * n + +    def find(self, x):  # 根を探す +        if self.parents[x] < 0: +            return x +        else: +            self.parents[x] = self.find(self.parents[x]) +            return self.parents[x] + +    def union(self, x, y): +        x = self.find(x) +        y = self.find(y) +        if x == y: +            return +        if self.parents[x] > self.parents[y]: +            x, y = y, x +        self.parents[x] += self.parents[y] +        self.parents[y] = x + +    def size(self, x): +        return -self.parents[self.find(x)] + +    def same(self, x, y): +        return self.find(x) == self.find(y) + +    def members(self, x): +        root = self.find(x) +        return [i for i in range(self.n) if self.find(i) == root] + +    def roots(self): +        return [i for i, x in enumerate(self.parents) if x < 0] + +    def group_count(self): +        return len(self.roots()) + +    def all_group_members(self): +        return {r: self.members(r) for r in self.roots()} + +    def __str__(self): +        return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots()) + + +def main(): +    N, M = MAP() +    edges = [] +    for _ in range(M): +        a, b = MAP() +        edges.append((a - 1, b - 1)) -    for i in range(M):  ## iの辺を消す -        matrix = [[0] * (N) for _ in range(N)] +    for i in range(M):  # i番目の辺を使わない +        uf = UnionFind(N) -            if j == i: +            if i == j: -            aa = a[j] - 1 -            bb = b[j] - 1 -            matrix[aa][bb] = 1 -        dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False) -        if dist_matrix[a[i] - 1][b[i] - 1] == float("inf"): +            a, b = edges[j] +            uf.union(a, b) +        if uf.group_count() > 1: -def main(): -    def iterate_tokens(): -        for line in sys.stdin: -            for word in line.split(): -                yield word - -    tokens = iterate_tokens() -    N = int(next(tokens))  # type: int -    M = int(next(tokens))  # type: int -    a = [int()] * (M)  # type: "List[int]" -    b = [int()] * (M)  # type: "List[int]" -    for i in range(M): -        a[i] = int(next(tokens)) -        b[i] = int(next(tokens)) -    solve(N, M, a, b) - -