Proving that cardinality of this set is at most $\frac{n(n-1)}{2}$ This question is from Apostol introduction to analytic number theory 144 page. Question 12

Let $G$ be a group and let $S$ be a subset of $n$ distinct elements of $G$ with the property that $a \in S$ implies $a^{-1} \notin S$. Consider the $n^2$ products of form $ab$, where $a$ and $b$ both belong to $S$. Then prove that at most $n(n-1) /2$ of these products belong to $S$.

Attempt : I assumed that let a, b, c belongs to S and a=bc then a$b^{-1}$ = c, but $b^{-1}$  doesn't belongs to S.There will also be a case when a doesn't belongs to S.
Then how to use it to prove the result in question? Unfortunately, I am not able to move ahead.
It is my humble request to help me

Presumably Apostol means there are at most $(n^2-n)/2$ ordered pairs $(a,b) \in S^2$ such that $ab\in S.$
Let $T=\{(a,c)\in S^2: a\ne c\}.$ Let $U=\{(a,c)\in T:a^{-1}c\in S\} .$
Now $T$ has $n^2-n$ members. And for any $(a,c)\in T,$ at most one of $(a,c),(c,a)$ belongs to $U.$ Because $a^{-1}c$ and $(a^{-1}c)^{-1}=c^{-1}a$ cannot both belong to $ S.$ So $U$ has at most half of the members of $T.$
So $U$ has at most $(n^2-n)/2$ members.
Let $V=\{(a,b)\in S^2: ab\in S\}.$ The function $F(\,(a,b)\,)=(a,ab)$ is a bijection, and $$\forall (a,b)\in S^2\,(\,(a,b)\in V\iff F(\,(a,b)\,)\in U\,).$$ So $V$ has exactly the same number of members that $U$ has.
