import java.util.*;
class Solution {
public Set<Integer> set = new TreeSet<>();
public boolean[] visit;
public int[] solution(int[] numbers) {
int sum = 0;
visit = new boolean[numbers.length];
recur(0, numbers, sum);
int[] answer = new int[set.size()];
Iterator<Integer> iterator = set.iterator();
for(int i=0; i<answer.length; i++) { answer[i] = iterator.next(); }
return answer;
}
public void recur(int n, int[] numbers, int sum) {
if(n==2) {
System.out.println(sum);
set.add(sum);
return;
}
for(int i=0; i<numbers.length; i++) {
if(visit[i]) { continue; }
visit[i] = true;
recur(n+1, numbers, sum+numbers[i]);
visit[i] = false;
}
}
}