Bajtłomiej is a mountain hiking enthusiast. This year he is spending his vacation in Low Byteland, a beautiful mountain region in the south of Byteland. Every morning he sets out on a hike from one of the shelters and walks a route that brings him back to the very same shelter by the evening (each day he may pick a different starting shelter). Bajtłomiej is a picky hiker, though: during a single day he never passes the same shelter twice. In other words, each day's route is a single simple cycle (a closed walk that returns to its start without revisiting any shelter).
After finishing each hike, he picks the most boring trail among those he walked that day (if several trails are equally boring, he picks any one of them) and erases it from his map. From that moment on he never uses that trail again. He keeps erasing trails until he can no longer plan a hike that meets his requirements (that is, until the remaining trails can no longer form any simple cycle), at which point he packs his backpack and goes home.
Write a program that reads the description of the trails in Low Byteland from standard input, computes how many hikes Bajtłomiej goes on, and writes the answer to standard output.
The first line contains two integers n and m (1≤n≤100000, 0≤m≤300000): the number of shelters and the number of trails in Low Byteland, respectively.
Each of the next m lines describes one trail. The i-th of them describes the trail numbered i and contains three integers a, b, and c separated by spaces (1≤a,b≤n, a=b, 1≤c≤5000). They mean that shelters a and b are joined by a trail whose interest coefficient is c (the lower the coefficient, the more boring the trail). There is at most one trail between any pair of shelters.
Print a single integer: the total number of hikes Bajtłomiej goes on (equivalently, the number of trails he erases from his map).