Problem

Source: Regional Olympiad - Federation of Bosnia and Herzegovina 2018

Tags: Sum, Sequence, algebra



Let $a_1, a_2,...,a_{2018}$ be a sequence of numbers such that all its elements are elements of a set $\{-1,1\}$. Sum $$S=\sum \limits_{1 \leq i < j \leq 2018} a_i a_j$$can be negative and can also be positive. Find the minimal value of this sum