N,M=[3,3]
l=[[1,2,1],[1,3,1],[2,3,3]]
inf=10**20
a=[[inf]*N for i in range(N)]
e=[[0]*N for i in range(N)]
for i,j,k in l:
    a[i-1][j-1]=k
    a[j-1][i-1]=k
    e[i-1][j-1]=1
    e[j-1][i-1]=1

ans=0
for k in range(N):
    for i in range(N):
        for j in range(N):
            if a[i][j]>a[i][k]+a[k][j]:
                if e[i][j]==1:
                    ans+=1
                    e[i][j]=e[j][i]=0
                a[i][j]=a[i][k]+a[k][j]

print(ans)


