#K46967. Valid Message Verification

    ID: 28094 Type: Default 1000ms 256MiB

Valid Message Verification

Valid Message Verification

You are given an integer m and a sequence of integers that represents a coded message. The message is considered valid according to the ancient Atrovia's dialect rules if and only if:

  • The message contains every integer from 1 to \(m\) at least once.
  • Every integer in the message is between 1 and \(m\) (inclusive).

Your task is to read the input from standard input, determine whether the message is valid, and print True if it is valid and False otherwise.

Examples

  • For input with m = 5 and message 4 2 3 1 5, the output should be True.
  • For input with m = 5 and message 1 2 1 3, the output should be False (since some numbers between 1 and 5 are missing).
  • For input with m = 3 and message 7 2 3 1, the output should be False (since 7 is out of range).

inputFormat

The input is read from stdin and consists of two lines:

  1. The first line contains a single integer \(m\), the highest number in the range.
  2. The second line contains a space-separated list of integers representing the message.

It is guaranteed that the input contains at least the value for \(m\); the message could be empty.

outputFormat

Output to stdout a single line containing either True if the message meets the rules specified, or False otherwise.

## sample
5
4 2 3 1 5
True