Problem:
Score : 300 points

Problem Statement

Given is a sequence of integers A_1, A_2, ..., A_N.
If its elements are pairwise distinct, print YES; otherwise, print NO.

Constraints

2 ≤ N ≤ 200000

1 ≤ A_i ≤ 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

If the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.

Sample Input 1

5
2 6 1 4 5

Sample Output 1

YES

The elements are pairwise distinct.

Sample Input 2

6
4 1 3 1 6 2

Sample Output 2

NO

The second and fourth elements are identical.

Sample Input 3

2
10000000 10000000

Sample Output 3

NO

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::collections::HashSet;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// 重複を取り除く別解
fn exe_other(n: usize, a: Vec<u64>) -> String {
    let mut uniq: Vec<&u64> = a.iter().collect();
    uniq.sort();
    uniq.dedup();
    if n == uniq.len() {
        "YES".to_string()
    } else {
        "NO".to_string()
    }
}

fn exe(n: usize, a: Vec<u64>) -> String {
    let uniq: HashSet<u64> = a.into_iter().collect();
    if n == uniq.len() {
        "YES".to_string()
    } else {
        "NO".to_string()
    }
}

fn main() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let ans = exe_other(n, a);
    println!("{}", ans);
}

#[test]
fn test() {
    assert_eq!(exe(5, vec![2, 6, 1, 4, 5]), "YES");
    assert_eq!(exe(6, vec![4, 1, 3, 1, 6, 2]), "NO");
    assert_eq!(exe(2, vec![10000000, 10000000]), "NO");

    assert_eq!(exe_other(5, vec![2, 6, 1, 4, 5]), "YES");
    assert_eq!(exe_other(6, vec![4, 1, 3, 1, 6, 2]), "NO");
    assert_eq!(exe_other(2, vec![10000000, 10000000]), "NO");
}