Imports System

Module Program
    Sub Main(args As String())
        Dim LongN As Long = Console.ReadLine()
        Dim tmpA As String() = Split(Console.ReadLine(), " ")

        Dim i As Long = 1
        Dim j As Long = 1
        Dim sameCount As Long = 0
        For i = 1 To LongN
            sameCount = 0
            For j = 1 To LongN Or sameCount > 1
                If tmpA(i - 1) = tmpA(j - 1) Then
                    sameCount = sameCount + 1
                End If
            Next

            If sameCount > 1 Then
                Console.WriteLine("NO")
                Exit Sub
            End If
        Next
        Console.WriteLine("YES")
    End Sub
End Module
