fork download
  1. n = int(input())
  2. a = list(map(int, input().split()))
  3.  
  4. res = set()
  5.  
  6. for i in range(n-1):
  7. for j in range(i+1, n):
  8. x = a[i] | a[j]
  9. res.add(x)
  10. print(x)
  11.  
  12. print(len(res))
Success #stdin #stdout 0.07s 14152KB
stdin
3
1 2 4
stdout
3
5
6
3