Frequent Opposite-Supported Numbers X78889


Statement
 

pdf   zip

Given a sequence of integers, we say that an integer nn is opposite-supported in the sequence if both nn and n-n appear in it. Write a program that finds a frequent opposite-supported number in a sequence.

Input

Input starts with a non-negative integer kk that indicates the desired frequency. Then, a sequence of integers follows, possibly distributed along several lines.

Output

Write the absolute value of the first integer in the sequence that is found both to appear at least kk times in it and to be opposite-supported in it. Write "NONE" if no such integer is found.

Public test cases
  • Input

    3
    1 -2 3 -1 2 1 -3 1

    Output

    1
    
  • Input

    33
    1 -2 3 -1 2 1 -3 1

    Output

    NONE
    
  • Input

    3
    -5 -5 -6 -6 -5 
    7 6 -6 7 -7 5 7

    Output

    6
    
  • Input

    3
    1111111111111111 -5 -5 -6 -6 -5 
    7 -6 7 -7 -6 6 5 7

    Output

    6
    
  • Information
    Author
    José Luis Balcázar
    Language
    English
    Official solutions
    Python
    User solutions
    Python