ADded counting triangles solution