#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

ll Div(ll n)
{
  for(ll i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
      return i;
  }
  return n;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}

 
int main()
{
  _FI 

  ll n;
  cin>>n;

  V<ll> arr(n);
  map<ll,ll> mp;
  forn(i,n)
    {
      cin>>arr[i];
      mp[arr[i]]++;
    }
    if(mp.size()==n)
    {
      cout<<"YES";
    }
    else
    {
      cout<<"NO";
    }
  

  return 0;
}














#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;


int main(){
  int n;
  cin >> n;
  vector<long long> A(n);
  for(int i=0;i<n;i++) cin >> A.at(i);
  vector<long long> sa(n+1,0);
  for(int i=0;i<n;i++) sa.at(i+1) = sa.at(i) + A.at(i);
  long long ans = 10000000000000000;
  for(int i=1;i<n-1;i++){
    long long left = sa.at(i+1);
    long long right = sa.at(n) - sa.at(i+1);
    
    int lsplit = min(int(upper_bound(sa.begin(),sa.end(),left/2) - sa.begin() - 2),i-1);
    int rsplit = min(int(upper_bound(sa.begin(),sa.end(),right/2 + left) - sa.begin() - 2),n-2);
    // cout << "rsplit = " << rsplit << endl;
    long long lM = min(max(sa.at(lsplit + 1),sa.at(i+1) - sa.at(lsplit + 1)),max(sa.at(lsplit + 2), sa.at(i+1) - sa.at(lsplit + 2)));
    long long rM = min(max(sa.at(rsplit + 1)-sa.at(i+1),sa.at(n)-sa.at(rsplit+1)) ,max(sa.at(rsplit+2)-sa.at(i+1),sa.at(n) - sa.at(rsplit+2)));
    // cout << "rM = " << rM << endl;
    long long M = max(lM,rM);
    long long m = min(sa.at(i+1) - lM,sa.at(n) - sa.at(i+1) - rM);
    // cout << i << ":" << M-m << " M = "<< M << " m = " << m << endl;
    ans = min(ans, M-m);
  }
  cout << ans << endl;
}
