n is always the multiple of 4. You have to select 4 numbers out of n and choose the second minimum number from the four numbers ,like that you have to add all the chosen numbers and find maximum out of it.

consider an example:

n=8

1 4 5 6 8 2 1 4

ans=7.

How?

first i will select **1 5 6 8** second minimum is 5

second i will select **1 4 2 4** second minimum is 2

maximum sum=5+2=7

next example-

n=8

1 3 3 4 2 3 4 3

ans=6

How?

first i will select **1 4 3 3** second minimum is 3

second i will select **2 3 4 3** second minimum is 3

maximum sum=3+3=6.