#include <iostream>

using namespace std;

int main()
{
    int n1,m1;
    cin>>n1>>m1;
    for(int i=0;i<m1;i++){
        int a,b,y;
        cin>>a>>b>>y;
    }
    int aa,bb;
    cin>>aa>>bb;
    cout<<m1/2;

}