Got a homework question here that I have been staring at for a while. I am being asked how many keys will exist in a network of 'n' number of nodes with keys being distributed on a per-host-pair basis.

I understand that there will be a key shared for every network connection that exists between nodes on the network and I have come up with samples of smaller network sizes and their number of keys to try and generate an algorithm that will answer the question but I have been butting my head against the table just to try and figure out the pattern.

Sample(UPDATED...The sample data that I provide here is not correct and was only discovered after the accepted answer was posted): 2 computers on a network results in 1 key

3 computers on a network = 3 keys

4 computers on a network = 6 keys

5 computers = 8 keys

6 computers = 14 keys

7 computers = 20 keys

8 computers = 28 keys... etc..etc.

I know by attaching the 'homework' tag to the question I am understanding that I cannot be directly given the answer - so if someone could at least give me a push in the right direction it would be greatly appreciated.