n=gets.to_i d=(0..n).map{|u|(0..n).map{|v|u==v ?0:n}} $<.map{|s|a,b=s.split.map &:to_i;d[a][b]=d[b][a]=1} (1..n).map{|w|(1..n).map{|u|(1..n).map{|v|d[u][v]=[d[u][v],d[u][w]+d[w][v]].min}}} z=0 (1..n).map{|u|(u+1..n).map{|v|(v+1..n).map{|w|d[u][v]!=2&&d[u][w]!=2&&d[v][w]!=2&&z+=1}}} p z