Count number of edges