The electric potential energy of a system of charges is given by
This sum extends over all pairs of charges. We do not let i=j, because that would be an interaction of a charge with itself and we include only terms with i < j to make sure that we count each pair only once.
For example, electric potential energy of four point charges q1, q2 , q3 and q4 would be given by,
Here, all the charges are to be substituted with sign.