fork(1) download
  1. n=int(input())
  2. s=0
  3. x = list(map(int, input().split()))
  4. x.sort()
  5. mn=x[n-1]
  6. for i in range (n):
  7. s+=x[i]
  8. if x[i]%4!=0 and x[i]<mn:
  9. mn=x[i]
  10.  
  11. if s%4==0 and mn%4!=0:
  12. s-=mn
  13. if s%4==0 and mn%4==0:
  14. print ("impossible")
  15. else:
  16. print (n-1, s)
Success #stdin #stdout 0.02s 9312KB
stdin
3
1 2 1
stdout
2 3