avengers-shield
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

A meeting between SHIELD and Avengers took place to stop Ultron. All the Avengers are present in the meeting. Everyone is shaking hands with others but exactly once. 

Tony Stark asked from Captain America that total how many handshakes took place in the meeting. Help Captain to calculate total handshakes.

INPUT:

The first line contains the number of test cases T, The next T lines follows.

Each line then contains an integer N, the total number of members attend the meeting.

OUTPUT:

Print the number of handshakes for each test-case.

Constraints:

1 ≤ T ≤ 1000

1 ≤ N ≤ 1000000

SAMPLE INPUT
2
1
2

SAMPLE OUTPUT
0
1