#define i(a,b) a=a<b?a:b;
d,a[100][100],b[100][100],u,v,c;
main(n)
{
	for(scanf("%d%*d",&n);u<n;)for(v=0;v<n;)b[u++][v++]=1<<28;
	for(;~scanf("%d%d%d",&u,&v,&c);a[--u][--v]=a[v][u]=b[u][v]=b[v][u]=c);
	for(u=0;u<n;u++)for(v=0;v<n;v++)for(c=0;c<n;c++)i(b[v][c],b[v][u]+b[u][c])
	for(u=-1;++u<n;)for(c=u;c<n;)a[u][c]>b[u][c++]?d++:0;
	printf("%d\n",d);
}
