import itertools p=[[i,j] for i in range(51) for j in range(51)][1:] print sum(1 for x,y in itertools.combinations(p,2) if x[0]*y[0]+x[1]*y[1]==0 or x[0]*(x[0]-y[0])+x[1]*(x[1]-y[1])==0 or (x[0]-y[0])*y[0]+(x[1]-y[1])*y[1]==0)