# include <iostream>

using namespace std;



int main(){
  int N, M;
  int a, b, c, count;
  int d[100][100], dc[100][100];

  // load the graph
  for(int m = 0; m < M; m++) {
    cin >> a >> b >> c;
    d[a][b] = c;
    d[b][a] = c;
  }
  dc = d;

  for(int k = 0; k < N; k++) {
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < N; j++) {
	d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  count = 0;
  for (int n = 0; n < N; n++) {
    for (int m = n; m < N; m++) {
      if (d[n][m] - dc[n][m] < 0) {
	count ++;
      }
    }
  }

  cout << count << endl;

  return 0;
}
