import sys

from collections import deque



n, m = list(map(int, sys.stdin.readline().split()))

ab = list(map(int, sys.stdin.read().split()))

ab = list(zip(*[ab] * 2))

graph = [set() for _ in range(n+1)]

for a, b in ab:

    graph[a].add(b)

    graph[b].add(a)



def main():

    que = set()

    for i in range(1, n+1):

        if len(graph[i]) == 1:

            que.add(i)

    res = len(que)

    while que:

        x = que.pop()

        y = graph[x].pop()

        graph[y] -= set([x])

        l = len(graph[y])

        if l == 0:

            que -= set([y])

            res -= 1

        elif l == 1:

            que.add(y)

            res += 1



    return res



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



n, m, *ab = list(map(int, sys.stdin.read().split()))

graph = [set() for _  in range(n)]

for a, b in zip(*[iter(ab)] * 2):

    a -= 1; b -= 1

    graph[a].add(b); graph[b].add(a)



def main():

    stack = [i for i in range(n) if len(graph[i]) == 1]

    bridges = 0

    while stack:

        x = stack.pop()

        if not graph[x]: continue

        y = graph[x].pop()

        graph[y].remove(x)

        bridges += 1

        if len(graph[y]) == 1:

            stack.append(y)

    print(bridges)



if __name__ ==  '__main__':

    main()
import sys
from collections import deque

n, m = list(map(int, sys.stdin.readline().split()))
ab = list(map(int, sys.stdin.read().split()))
ab = list(zip(*[ab] * 2))
graph = [set() for _ in range(n + 1)]
for a, b in ab:
    graph[a].add(b)
    graph[b].add(a)


def main():
    que = set()
    for i in range(1, n + 1):
        if len(graph[i]) == 1:
            que.add(i)
    res = len(que)
    while que:
        x = que.pop()
        y = graph[x].pop()
        graph[y] -= set([x])
        l = len(graph[y])
        if l == 0:
            que -= set([y])
            res -= 1
        elif l == 1:
            que.add(y)
            res += 1
    return res


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

n, m, *ab = list(map(int, sys.stdin.read().split()))
graph = [set() for _ in range(n)]
for a, b in zip(*[iter(ab)] * 2):
    a -= 1
    b -= 1
    graph[a].add(b)
    graph[b].add(a)


def main():
    stack = [i for i in range(n) if len(graph[i]) == 1]
    bridges = 0
    while stack:
        x = stack.pop()
        if not graph[x]:
            continue
        y = graph[x].pop()
        graph[y].remove(x)
        bridges += 1
        if len(graph[y]) == 1:
            stack.append(y)
    print(bridges)


if __name__ == "__main__":
    main()

-from collections import deque -n, m = list(map(int, sys.stdin.readline().split())) -ab = list(map(int, sys.stdin.read().split())) -ab = list(zip(*[ab] * 2)) -graph = [set() for _ in range(n + 1)] -for a, b in ab: +n, m, *ab = list(map(int, sys.stdin.read().split())) +graph = [set() for _ in range(n)] +for a, b in zip(*[iter(ab)] * 2): +    a -= 1 +    b -= 1 -    que = set() -    for i in range(1, n + 1): -        if len(graph[i]) == 1: -            que.add(i) -    res = len(que) -    while que: -        x = que.pop() +    stack = [i for i in range(n) if len(graph[i]) == 1] +    bridges = 0 +    while stack: +        x = stack.pop() +        if not graph[x]: +            continue -        graph[y] -= set([x]) -        l = len(graph[y]) -        if l == 0: -            que -= set([y]) -            res -= 1 -        elif l == 1: -            que.add(y) -            res += 1 -    return res +        graph[y].remove(x) +        bridges += 1 +        if len(graph[y]) == 1: +            stack.append(y) +    print(bridges) -    ans = main() -    print(ans) +    main()