NR==1{N=$1;M=$2}
NR>1{A[NR-1]=$1;B[NR-1]=$2;C[NR-1]=$3;D[+$1,+$2]=D[+$2,+$1]=$3}
END{
	for(;k++<N;)for(i=0;i++<N;)for(j=0;j++<N;)D[i,j]>D[i,k]+D[k,j]&&D[i,j]=D[i,k]+D[k,j];
	for(i=0;i++<M;)S+=D[A[i],B[i]]<C[i];
	print+S
}
