//Jatin Kumar
//jatiny17

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define print4(a,b,c,d) cout<<a<<" "<< b <<" "<<c<<" "<<d<<"\n";
#define s(a) sort(a.begin(),a.end());
#define lli long long int
#define ulli unsigned long long int
#define dd long double
#define pi pair<lli,lli>
#define pp pair<lli,pi>
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

//***************************************************//

void seive(bool a[],int n)
{
    memset(a,true,n);

    a[0]=false;
    a[1]=false;

    for(int i=2;i*i<=n;i++)
    {
        if(a[i]==true)
        {
            for(int j=2*i;j<=n;j+=i)
                a[j]=false;
        }
    }
}

lli lcm(lli a,lli b)
{
    return((a*b)/__gcd(a,b));
}
//***************************************************//

lli add(lli a,lli b)
{return ((a%mod)+(b%mod))%mod;}

lli subt(lli a,lli b)
{return ((a%mod)-(b%mod))%mod;}

lli mul(lli a,lli b)
{  return ((a%mod)*(b%mod))%mod;}

//****************************************************//
lli multiply(lli a,lli b,lli m=mod)
{
    lli r=0;

    while(b)
    {
        if(b%2==1)
        r=(r+a)%m;

        a=(a*2)%m;
        b=b/2;
    }

    return r;
}

lli power(lli a,lli n,lli m)
{
    ulli r=1;

    a=a%m;

    while(n)
    {
        if(n%2==1)
        r=multiply(r,a,m);

        n=n/2;
        a=multiply(a,a,m);
    }

    return r;
}

lli gcd(lli a,lli b)
{
    if(b==0)
    return a;

    else
    return gcd(b,a%b);
}

int main()
{
    fast;

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    lli n;
    cin>>n;

    lli a[200005];
    lli b[200005];
    lli c[200005];

    memset(b,0,sizeof(b));
    memset(c,0,sizeof(c));

    for(lli i=1;i<=n;i++)
    {
    	cin>>a[i];

    	b[a[i]]++;
    	c[a[i]]++;
    }

    for(lli i=2;i<=n;i+=3)
    {

    	// if(i-1>=1)
    	{
    		b[i]+=b[i-1];
    		b[i-1]=0;
    	}

    	if(i+1<=n)
    	{
    		b[i]+=b[i+1];
    		b[i+1]=0;
    	}
    }

    // for(lli i=1;i<=n;i++)
    // 	cout<<b[i]<<" ";
    // cout<<"\n";

    lli min=0;

    // for(lli i=1;i<=n;i++)
    // {
    // 	if(b[i]!=0)
    // 		min++;
    // }

    lli i=1;
    while(i<=n)
    {
    	if(b[i]>0)
    	{
    		min++;
    		i+=3;
    	}

    	else
    		i++;
    }

    // for(lli i=0;i<=n+1;i++)
    // 	cout<<c[i]<<" ";

    // cout<<"\n";

    for(lli i=1;i<=n;i++)
    {
   		if(c[i-1]==0)
   		{

   			if(c[i]>=1)
   			{
   				c[i]-=1;
   				c[i-1]++;
   			}

	    	if(c[i]>1)
	    	{
	   			c[i]-=1;
	   			c[i+1]++;
	   		}
   		}

   		else
   		{
   			if(c[i]>1)
   			{
   				c[i]-=1;
   				c[i+1]++;
   			}

    		if(c[i]>1)
    		{
   				c[i-1]+=1;
   				c[i]--;
   			}
   		}
    }

    lli max=0;

    // for(lli i=0;i<=n+1;i++)
    // 	cout<<c[i]<<" ";

    // cout<<"\n";

    for(lli i=0;i<=n+1;i++)
    {
    	if(c[i]!=0)
    		max++;
    }

    print2(min,max);

}


//Jatin Kumar
//jatiny17

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define print4(a,b,c,d) cout<<a<<" "<< b <<" "<<c<<" "<<d<<"\n";
#define s(a) sort(a.begin(),a.end());
#define lli long long int
#define ulli unsigned long long int
#define dd long double
#define pi pair<lli,lli>
#define pp pair<lli,pi>
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

//***************************************************//

void seive(bool a[],int n)
{
    memset(a,true,n);

    a[0]=false;
    a[1]=false;

    for(int i=2;i*i<=n;i++)
    {
        if(a[i]==true)
        {
            for(int j=2*i;j<=n;j+=i)
                a[j]=false;
        }
    }
}

lli lcm(lli a,lli b)
{
    return((a*b)/__gcd(a,b));
}
//***************************************************//

lli add(lli a,lli b)
{return ((a%mod)+(b%mod))%mod;}

lli subt(lli a,lli b)
{return ((a%mod)-(b%mod))%mod;}

lli mul(lli a,lli b)
{  return ((a%mod)*(b%mod))%mod;}

//****************************************************//
lli multiply(lli a,lli b,lli m=mod)
{
    lli r=0;

    while(b)
    {
        if(b%2==1)
        r=(r+a)%m;

        a=(a*2)%m;
        b=b/2;
    }

    return r;
}

lli power(lli a,lli n,lli m)
{
    ulli r=1;

    a=a%m;

    while(n)
    {
        if(n%2==1)
        r=multiply(r,a,m);

        n=n/2;
        a=multiply(a,a,m);
    }

    return r;
}

lli gcd(lli a,lli b)
{
    if(b==0)
    return a;

    else
    return gcd(b,a%b);
}

int main()
{
    fast;

    // #ifndef ONLINE_JUDGE
    // freopen("input1.txt", "r", stdin);
    // freopen("output1.txt", "w", stdout);
    // #endif

    lli n;
    cin>>n;

    lli a[200005];
    lli b[200005];
    lli c[200005];

    memset(b,0,sizeof(b));
    memset(c,0,sizeof(c));

    // cout<<n<<"\n";

    for(lli i=1;i<=n;i++)
    {
    	cin>>a[i];

    	b[a[i]]++;
    	c[a[i]]++;
    }

    for(lli i=2;i<=n;i+=3)
    {
    // 	cout<<i<<" ";
    	// if(i-1>=1)
    	{
    		b[i]+=b[i-1];
    		b[i-1]=0;
    	}

    	if(i+1<=n)
    	{
    		b[i]+=b[i+1];
    		b[i+1]=0;
    	}
    }

    // for(lli i=1;i<=n;i++)
    // 	cout<<b[i]<<" ";
    // cout<<"\n";

    lli min=0;

    for(lli i=2;i<=n;i++)
    {
    	if(b[i]>0)
    		min++;
    }

    // for(lli i=0;i<=n+1;i++)
    // 	cout<<c[i]<<" ";

    // cout<<"\n";

    for(lli i=1;i<=n;i++)
    {
   		if(c[i-1]==0)
   		{

   			if(c[i]>=1)
   			{
   				c[i]-=1;
   				c[i-1]++;
   			}

	    	if(c[i]>1)
	    	{
	   			c[i]-=1;
	   			c[i+1]++;
	   		}
   		}

   		else
   		{
   			if(c[i]>1)
   			{
   				c[i]-=1;
   				c[i+1]++;
   			}

    		if(c[i]>1)
    		{
   				c[i-1]+=1;
   				c[i]--;
   			}
   		}
    }

    lli max=0;

    // for(lli i=0;i<=n+1;i++)
    // 	cout<<c[i]<<" ";

    // cout<<"\n";

    for(lli i=0;i<=n+1;i++)
    {
    	if(c[i]!=0)
    		max++;
    }

    print2(min,max);

}


//Jatin Kumar
//jatiny17

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define print4(a,b,c,d) cout<<a<<" "<< b <<" "<<c<<" "<<d<<"\n";
#define s(a) sort(a.begin(),a.end());
#define lli long long int
#define ulli unsigned long long int
#define dd long double
#define pi pair<lli,lli>
#define pp pair<lli,pi>
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

//***************************************************//

void seive(bool a[],int n)
{
    memset(a,true,n);

    a[0]=false;
    a[1]=false;

    for(int i=2;i*i<=n;i++)
    {
        if(a[i]==true)
        {
            for(int j=2*i;j<=n;j+=i)
                a[j]=false;
        }
    }
}

lli lcm(lli a,lli b)
{
    return((a*b)/__gcd(a,b));
}
//***************************************************//

lli add(lli a,lli b)
{return ((a%mod)+(b%mod))%mod;}

lli subt(lli a,lli b)
{return ((a%mod)-(b%mod))%mod;}

lli mul(lli a,lli b)
{  return ((a%mod)*(b%mod))%mod;}

//****************************************************//
lli multiply(lli a,lli b,lli m=mod)
{
    lli r=0;

    while(b)
    {
        if(b%2==1)
        r=(r+a)%m;

        a=(a*2)%m;
        b=b/2;
    }

    return r;
}

lli power(lli a,lli n,lli m)
{
    ulli r=1;

    a=a%m;

    while(n)
    {
        if(n%2==1)
        r=multiply(r,a,m);

        n=n/2;
        a=multiply(a,a,m);
    }

    return r;
}

lli gcd(lli a,lli b)
{
    if(b==0)
    return a;

    else
    return gcd(b,a%b);
}

int main()
{
    fast;

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    lli n;
    cin>>n;

    lli a[n+1];
    lli b[n+1];
    lli c[n+2];

    memset(b,0,sizeof(b));
    memset(c,0,sizeof(c));

    for(lli i=1;i<=n;i++)
    {
    	cin>>a[i];

    	b[a[i]]++;
    	c[a[i]]++;
    }

    for(lli i=2;i<=n;i+=3)
    {

    	if(i-1>=1)
    	{
    		b[i]+=b[i-1];
    		b[i-1]=0;
    	}

    	if(i+1<=n)
    	{
    		b[i]+=b[i+1];
    		b[i+1]=0;
    	}
    }

    // for(lli i=1;i<=n;i++)
    // 	cout<<b[i]<<" ";
    // cout<<"\n";

    lli min=0;

    for(lli i=1;i<=n;i++)
    {
    	if(b[i]!=0)
    		min++;
    }

    for(lli i=1;i<=n;i++)
    {
    	if(c[i]>1)
    	{
    		c[i]-=1;
    		c[i-1]++;

    		if(c[i]>1)
    		{
    			c[i]-=1;
    			c[i+1]++;
    		}
    	}
    }

    lli max=0;

    // for(lli i=0;i<=n+1;i++)
    // 	cout<<c[i]<<" ";

    // cout<<"\n";

    for(lli i=0;i<=n+1;i++)
    {
    	if(c[i]!=0)
    		max++;
    }

    print2(min,max);

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    int ans = 0;
    int plevo,pdesno;
    plevo=pdesno=0;
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            ans++;
            if(cnt[i]==2)
            {
                if(!plevo&&!cnt[i-1])
                {
                    ans++;
                    plevo=1;
                }
                else
                {
                    plevo = 0;
                }
              if(!pdesno&&!plevo&&!cnt[i+1])
              {
                  ans++;
                  pdesno=1;
              }
              else
              {
                  pdesno=0;
              }
            }
            else if(cnt[i]>=3)
            {
                if(!cnt[i-1]&&!plevo)
                {
                    ans++;
                    plevo=1;
                }
                else
                {
                    plevo = 0;
                }
                if(!cnt[i+1]&&!pdesno)
                {
                    ans++;
                    pdesno=1;
                }
                else
                {
                    pdesno=0;
                }
            }
        }
    }
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];
int dp[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            dp[i-1]=1;
            cnt[i]--;
            if(cnt[i]>1)
                dp[i+1]=1;
        }
    }
    int ans = 0;
    for(int i = 0;i<=n+1;i++)
        ans+=dp[i];
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];
int dp[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            dp[i-1]=1;
            cnt[i]--;
            if(cnt[i]>1)
                dp[i+1]=1;
            else if(cnt[i])
                dp[i]=1;
        }
    }
    int ans = 0;
    for(int i = 0;i<=n+1;i++)
        ans+=dp[i];
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];
int dp[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            if(!dp[i-1])
            {
                dp[i-1]=1;
                cnt[i]--;
            }
            if(!dp[i]&&cnt[i])
            {
                dp[i]=1;
                cnt[i]--;
            }
            if(!dp[i+1]&&cnt[i])
            {
                cnt[i]--;
                dp[i+1]=1;
            }
        }
    }
    int ans = 0;
    for(int i = 0;i<=n+1;i++)
        ans+=dp[i];
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    int ans = 0;
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            ans++;
            if(cnt[i]>=2&&(!cnt[i-1]||!cnt[i+1]))
                ans++;
            if(cnt[i]>=3&&!cnt[i-1]&&!cnt[i+1])
                ans++;
        }
    }
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int cnt[200005];
int dp[200005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++)
        {
            int a;
            cin>>a;
            cnt[a]++;
        }
    int ansmini=0;
    for(int i = 1;i<=n;)
    {
        if(cnt[i])
        {
            ansmini++;
            i+=3;
        }
        else
            i++;
    }
    cout<<ansmini<<" ";
    for(int i = 1;i<=n;i++)
    {
        if(cnt[i])
        {
            dp[i-1]=1;
            cnt[i]--;
            if(cnt[i])
                dp[i+1]=1;
        }
    }
    int ans = 0;
    for(int i = 0;i<=n+1;i++)
        ans+=dp[i];
    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                            fr[i] = 1;
                        }
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    if( sum == lg + 1 )
        {
            maxi += lg + 1;

            if( fr[i - lg - 1] != 0 )
                maxi--;

            fr[i - lg - 1] = 1;
        }
    else if( sum >= lg + 2 )
        {
            maxi += lg + 2;

            if( fr[i - lg - 1] != 0 )
                maxi--;

            fr[i - lg - 1] = 1;
            fr[i] = 1;
        }
    else
        maxi += lg;
    lg = sum = 0;
    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n + 1; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                            fr[i] = 1;
                        }
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        maxi += lg + 1;
                    else if( sum >= lg + 2 )
                        maxi += lg + 2;
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    if( sum == lg + 1 )
        maxi += lg + 1;
    else if( sum >= lg + 2 )
        maxi += lg + 2;
    else
        maxi += lg;

    lg = sum = 0;
    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n + 1; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] ++;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] ++;
                            fr[i]++;
                        }
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                            fr[i] = 1;
                        }
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    if( sum == lg + 1 )
        maxi += lg + 1;
    else if( sum >= lg + 2 )
        maxi += lg + 2;
    else
        maxi += lg;

    lg = sum = 0;
    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n, nr, mini, maxi;
int fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    int x;
    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= 200000; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    int lg = 0, sum = 0;

    for( int i = 1; i <= 200000; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        maxi += lg + 1;
                    else if( sum >= lg + 2 )
                        maxi += lg + 2;
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= 200000; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= 200000; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        maxi += lg + 1;
                    else if( sum >= lg + 2 )
                        maxi += lg + 2;
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    if( sum == lg + 1 )
        maxi += lg + 1;
    else if( sum >= lg + 2 )
        maxi += lg + 2;
    else
        maxi += lg;

    lg = sum = 0;
    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n + 1; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                fr[i]++;

                            fr[i - lg - 1] ++;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] ++;
                            fr[i]++;
                        }

                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, nr, mini, maxi;
long long fr[200005];
int main()
{
    cin.tie( 0 );
    ios_base::sync_with_stdio( false );

    cin >> n;
    long long x;

    for( int i = 1; i <= n; i++ )
        {
            cin >> x;
            fr[x]++;
        }

    for( int i = 1; i <= n; i++ )
        if( fr[i] )
            {
                mini++;
                i += 2;
            }

    long long lg = 0, sum = 0;

    for( int i = 1; i <= n; i++ )
        {
            if( fr[i] == 0 )
                {
                    if( sum == lg + 1 )
                        {
                            maxi += lg + 1;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                        }
                    else if( sum >= lg + 2 )
                        {
                            maxi += lg + 2;

                            if( fr[i - lg - 1] != 0 )
                                maxi--;

                            fr[i - lg - 1] = 1;
                            fr[i] = 1;
                        }
                    else
                        maxi += lg;

                    lg = sum = 0;
                }
            else
                lg++, sum += fr[i];
        }

    if( lg > 0 && sum > 0 )
        {
            if( sum == lg + 1 )
                {
                    maxi += lg + 1;

                    if( fr[n + 1 - lg - 1] != 0 )
                        maxi--;

                    fr[n + 1 - lg - 1] = 1;
                }
            else if( sum >= lg + 2 )
                {
                    maxi += lg + 2;

                    if( fr[n + 1 - lg - 1] != 0 )
                        maxi--;

                    fr[n + 1 - lg - 1] = 1;
                    fr[n + 1] = 1;
                }
            else
                maxi += lg;

            lg = sum = 0;
        }

    cout << mini << ' ' << maxi;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1] and spisok[i] > 1) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0 and spisok[i] + 1 <= n) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] + 1] and check[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
            ansmn.insert(spisok[i] + 1);
            ololololo[spisok[i] + 1]++;
            check[spisok[i]] = 0;
        }

        if (check[spisok[i] - 1] and check[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
            ansmn.insert(spisok[i] - 1);
            ololololo[spisok[i] - 1]++;
            check[spisok[i]] = 0;
        }

    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    set<ll> ansmx, ansmn;
    map<ll, ll> lll;

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] - 1] == 0 and lll[spisok[i] - 1] == 0) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0 and lll[spisok[i]] == 0) {
            ansmx.insert(spisok[i]);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i] + 1);
            check[spisok[i]]--;
            lll[spisok[i] + 1]++;
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmx) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            if (check[spisok[i] + 1] == 0) {
                ansmx.insert(spisok[i] + 1);
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1] and spisok[i] > 1) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0 and spisok[i] + 1 <= n) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] - 1]) {
            ansmn.insert(spisok[i] - 1);
            ololololo[spisok[i] - 1]++;
            check[spisok[i]] = 0;
        }

        if (check[spisok[i] + 1] and check[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
            ansmn.insert(spisok[i] + 1);
            ololololo[spisok[i] + 1]++;
            check[spisok[i]] = 0;
        }
    }

//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    set<ll> ansmx, ansmn;
    map<ll, ll> lll;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1] and !lll[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i] + 1);
            lll[spisok[i] + 1]++;
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    set<ll> ansmx, ansmn;
    map<ll, ll> lll;
    map<ll, bool> used;

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] - 1] == 0 and !used[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            used[spisok[i] - 1] = true;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0 and !used[spisok[i]]) {
            ansmx.insert(spisok[i]);
            used[spisok[i]] = true;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i] + 1);
            check[spisok[i]]--;
            used[spisok[i] + 1] = true;
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmx) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1] and spisok[i] > 1) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0 and spisok[i] + 1 <= n) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] - 1]) {
            ansmn.insert(spisok[i] - 1);
            check[spisok[i]] = 0;
        }

        if (check[spisok[i] + 1] and check[spisok[i]]) {
            ansmn.insert(spisok[i] + 1);
            check[spisok[i]] = 0;
        }
    }

//    for (auto i : ansmx) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1] and spisok[i] > 1) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0 and spisok[i] + 1 <= n) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i] + 1] == 0 and olala[spisok[i] - 1] == 0) {
            ansmn.insert(spisok[i]);
        } else {
            if (olala[spisok[i] + 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] + 1);
                ololololo[spisok[i] + 1]++;
                olala[spisok[i]] = 0;
            }

            if (olala[spisok[i] - 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] - 1);
                ololololo[spisok[i] - 1]++;
                olala[spisok[i]] = 0;
            }
        }

    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    set<ll> ansmx, ansmn;
    map<ll, ll> lll;

    for (int i = 0; i < spisok.size(); ++i) {
        if (check[spisok[i] - 1] == 0 and lll[spisok[i] - 1] == 0) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i] + 1);
            check[spisok[i]]--;
            lll[spisok[i] + 1]++;
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i] + 1] == 0 and olala[spisok[i] - 1] == 0 and ololololo[spisok[i] - 1] == 0) {
            ansmn.insert(spisok[i] + 1);
            ololololo[spisok[i] + 1]++;
        } else {
            if (olala[spisok[i] + 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] + 1);
                ololololo[spisok[i] + 1]++;
                olala[spisok[i]] = 0;
            }

            if (olala[spisok[i] - 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] - 1);
                ololololo[spisok[i] - 1]++;
                olala[spisok[i]] = 0;
            }
        }

    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i] - 1]++;
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
        }
        if (check[spisok[i]] > 1) {
            if (check[spisok[i] + 1] == 0) {
                ansmx.insert(spisok[i] + 1);
                check[spisok[i] + 1]++;
            }
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i] + 1] == 0 and olala[spisok[i] - 1] == 0) {
            ansmn.insert(spisok[i]);
        } else {
            if (olala[spisok[i] + 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] + 1);
                ololololo[spisok[i] + 1]++;
                olala[spisok[i]] = 0;
            }

            if (olala[spisok[i] - 1] and olala[spisok[i]] > 0 and ololololo[spisok[i]] == 0) {
                ansmn.insert(spisok[i] - 1);
                ololololo[spisok[i] - 1]++;
                olala[spisok[i]] = 0;
            }
        }

    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
typedef long long ll;
typedef long double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    ll n, m;
//    cin >> n >> m;
//    vector<ll> spisok;
//    map<ll, bool> check;
//
//    for (int i = 0; i < n; ++i) {
//        ll a;
//        cin >> a;
//        spisok.push_back(a);
//        check[a] = true;
//    }
//
//    sort(spisok.begin(), spisok.end());
//
//    for (int i = 0; i < m; ++i) {
//
//    }

    ll n;
    cin >> n;

    vector<ll> spisok(n);
    map<ll, ll> check;
    set<ll> ol;
    for (int i = 0; i < n; ++i) {
        cin >> spisok[i];
        ol.insert(spisok[i]);
        check[spisok[i]]++;
    }
    sort(spisok.begin(), spisok.end());
    spisok.clear();
    for (auto i : ol) {
        spisok.push_back(i);
    }
    map<ll, ll> olala = check;
    ll mx = 0, mn = check.size();
    set<ll> ansmx, ansmn;

    for (int i = 0; i < spisok.size(); ++i) {
        if (!check[spisok[i] - 1]) {
            ansmx.insert(spisok[i] - 1);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i]);
            check[spisok[i]]--;
        }
        if (check[spisok[i]] > 0) {
            ansmx.insert(spisok[i] + 1);
        }
    }
    map<ll, ll> ololololo;

    for (int i = 0; i < spisok.size(); ++i) {
        if (olala[spisok[i]] == 0 or ololololo[spisok[i]] != 0) {
            continue;
        }
        if (olala[spisok[i] - 1] != 0) {
            olala[spisok[i]] = 0;
            ansmn.insert(spisok[i] - 1);
        } else {
            olala[spisok[i]] = 0;
            olala[spisok[i] + 1]++;
            ololololo[spisok[i] + 1]++;
            ansmn.insert(spisok[i] + 1);
        }
    }
//
//    for (auto i : ansmn) {
//        cout << i << " ";
//    }
//    cout << '\n';

    cout << ansmn.size() << " " << ansmx.size();

    return 0;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] == 0)
                        continue ;
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] == 0)
                        continue ;
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]])
                        continue ;
                if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 ;
const int inf = 2e9 + 19 ;

int a[MAX_N] , mn , mx , n ;
bool mark[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++)
                cin >> a[i] ;
        sort(a , a + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (!mark[a[i] - 1])
                        mark[a[i] - 1] = true , mx ++ ;
                else if (!mark[a[i]])
                        mark[a[i]] = true , mx ++ ;
                else if (!mark[a[i] + 1])
                        mark[a[i] + 1] = true , mx ++ ;
        }
        memset(mark , 0 , sizeof(mark)) ;
        for (int i = 0 ; i < n ; i ++)
                if (!mark[a[i]] && !mark[a[i] - 1] && !mark[a[i] + 1])
                        mark[a[i] + 1] = true , mn ++ ;
        cout << mn << ' ' << mx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define int ll

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int32_t main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] > 1 && cntmx[mx[i] - 1] && cntmx[mx[i] + 1]) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                        continue ;
                }
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i]] == 1)
                        continue ;
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]] && cntmn[mn[i] - 1] && cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] == 0)
                        continue ;
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define int ll

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int32_t main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] > 1 && cntmx[mx[i] - 1] && cntmx[mx[i] + 1]) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                        continue ;
                }
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i]] == 1)
                        continue ;
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]] == 1 && cntmn[mn[i] - 1] == 0 && cntmn[mn[i] + 1] == 0) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                        continue ;
                }
                if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
                if (cntmn[mn[i]])
                        continue ;
                else if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i]] == 0)
                        continue ;
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] == 0)
                        continue ;
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]] == 0)
                        continue ;
                if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define int ll

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int32_t main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] > 1 && cntmx[mx[i] - 1] && cntmx[mx[i] + 1]) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                        continue ;
                }
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i]] == 1)
                        continue ;
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]] == 1 && cntmn[mn[i] - 1] == 0 && cntmn[mn[i] + 1] == 0) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                        continue ;
                }
                if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                if (cntmn[mn[i]])
                        continue ;
                else if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int a[MAX_N] , mn , mx , n ;
bool mark[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++)
                cin >> a[i] ;
        sort(a , a + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (!mark[a[i] - 1])
                        mark[a[i] - 1] = true , mx ++ ;
                else if (!mark[a[i]])
                        mark[a[i]] = true , mx ++ ;
                else if (!mark[a[i] + 1])
                        mark[a[i] + 1] = true , mx ++ ;
        }
        memset(mark , 0 , sizeof(mark)) ;
        for (int i = 0 ; i < n ; i ++)
                if (!mark[a[i]] && !mark[a[i] - 1] && !mark[a[i] + 1])
                        mark[a[i] + 1] = true , mn ++ ;
        cout << mn << ' ' << mx ;
        return (0) ;
}


// Give me My Shotgun

#include <bits/stdc++.h>
using namespace std ;

#define all(x) x.begin() , x.end()

#define PB push_back
#define F first
#define S second
#define _sz(x) (int)x.size()

#define debug(x) cerr << #x << " = " << x << endl

typedef long long ll ;
typedef pair<int , int> pii ;

const int MAX_N = 200 * 1000 + 19 ;
const int inf = 2e9 + 19 ;

int n , a[MAX_N] , mn[MAX_N] , mx[MAX_N] , cntmx[MAX_N] , cntmn[MAX_N] ;

int main() {
        ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
        cin >> n ;
        for (int i = 0 ; i < n ; i ++) {
                cin >> a[i] ;
                mx[i] = a[i] ;
                mn[i] = a[i] ;
                cntmn[a[i]] ++ ;
                cntmx[a[i]] ++ ;
        }
        sort(mn , mn + n) , sort(mx , mx + n) ;
        for (int i = 0 ; i < n ; i ++) {
                if (cntmx[mx[i]] > 1 && cntmx[mx[i] - 1] && cntmx[mx[i] + 1]) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                        continue ;
                }
                if (cntmx[mx[i] - 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] -- ;
                        cntmx[mx[i]] ++ ;
                }
                else if (cntmx[mx[i] + 1] == 0) {
                        cntmx[mx[i]] -- ;
                        mx[i] ++ ;
                        cntmx[mx[i]] ++ ;
                }
        }
        for (int i = 0 ; i < n ; i ++) {
                if (cntmn[mn[i]] && cntmn[mn[i] - 1] && cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                if (cntmn[mn[i] - 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] -- ;
                        cntmn[mn[i]] ++ ;
                }
                else if (cntmn[mn[i] + 1]) {
                        cntmn[mn[i]] -- ;
                        mn[i] ++ ;
                        cntmn[mn[i]] ++ ;
                }
        }
        int ansmn = 0 , ansmx = 0 ;
        map<int , int> mini , maxi ;
        for (int i = 0 ; i < n ; i ++) {
                mini[mn[i]] ++ ;
                if (mini[mn[i]] == 1)
                        ansmn ++ ;
                maxi[mx[i]] ++ ;
                if (maxi[mx[i]] == 1)
                        ansmx ++ ;
        }
        cout << ansmn << ' ' << ansmx ;
        return (0) ;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> cnt(n+1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    int minRes = 0;
    for (int i = 1; i <= n; i++) {
        if (cnt[i]) {
            minRes++;
            i += 2;
        }
    }

    sort(a.begin(), a.end());
    vector <char> used(n+2);
    for (int i = 0; i < a.size(); i++) {
        used[a[i]] = true;
    }
    for (int i = 0; i < a.size(); i++) {
        if (used[a[i] - 1] == false) {
            used[a[i] - 1] = true;
            used[a[i]] = false;
            a[i]--;
        } else {
            if (used[a[i]] == false) {
                used[a[i]] = true;
            } else {
                if (i == 0) continue;
                if (i > 0 && a[i-1] == a[i] && a[i] < n + 1 && (i == n-1 || a[i] != a[i+1])) {
                    used[a[i] + 1] = true;
                    a[i]++;
                }
            }
        }
    }
    int maxRes = 0;
    for (int i = 0; i <= n+1; i++) {
        maxRes += used[i];
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+2);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = 1;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i+1] - res[i] < 3) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    for (int i = 1; i < n-1; i++) {
        if (a[i] - a[i-1] == 1 && a[i+1] - a[i] == 0) {
            maxRes++;
            a[i] = a[i-1];
            break;
        }
    }
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                //a[i+1] = a[i+1] + 1;
                used[a[i+1] + 1] = 1;
                int j = i+1;
                while(j < n && a[j] == a[i]) {
                    a[j] = a[i] + 1;
                    j++;
                }
                i = j - 2;
            }
        }
    }

    for (int i = 0; i <= n+1; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> cnt(n+1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    int minRes = 0;
    for (int i = 1; i <= n; i++) {
        if (cnt[i]) {
            minRes++;
            i += 2;
        }
    }

    sort(a.begin(), a.end());
    vector <char> used(n+2);
    for (int i = 0; i < a.size(); i++) {
        used[a[i]] = true;
    }
    for (int i = 0; i < a.size(); i++) {
        if (used[a[i] - 1] == false) {
            used[a[i] - 1] = true;
            used[a[i]] = false;
            a[i]--;
        } else {
            if (used[a[i]] == false) {
                used[a[i]] = true;
            } else {
                if (i == 0) continue;
                if (i > 0 && a[i-1] == a[i] && a[i] < n + 1) {
                    used[a[i] + 1] = true;
                    a[i]++;
                }
            }
        }
    }
    int maxRes = 0;
    for (int i = 0; i <= n+1; i++) {
        maxRes += used[i];
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i+1] - res[i] < 3) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }
    sort(a.begin(), a.end());
    vector <char> used(n+2);
    for (int i = 0; i < a.size(); i++) {
        used[a[i]] = true;
    }
    for (int i = 0; i < a.size(); i++) {
        if (used[a[i] - 1] == false) {
            used[a[i] - 1] = true;
            used[a[i]] = false;
            a[i]--;
        } else {
            if (used[a[i]] == false) {
                used[a[i]] = true;
            } else {
                if (i == 0) continue;
                if (i > 0 && a[i-1] == a[i] && a[i] < n + 1) {
                    used[a[i] + 1] = true;
                    a[i]++;
                }
            }
        }
    }
    int maxRes = 0;
    for (int i = 0; i <= n+1; i++) {
        maxRes += used[i];
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+2);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = true;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i] + 1 == res[i+1]) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                a[i+1] = a[i+1] + 1;
                used[a[i+1]] = 1;
            }
        }
    }
    for (int i = 0; i <= n+1; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+2);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = 1;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i+1] - res[i] < 3) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                //a[i+1] = a[i+1] + 1;
                used[a[i+1] + 1] = 1;
                int j = i+1;
                while(j < n && a[j] == a[i]) {
                    a[j] = a[i] + 1;
                    j++;
                }
                i = j - 2;
            }
        }
    }/*
    for (int i = 1; i < n-1; i++) {
        if (a[i] - a[i-1] == 1 && a[i+1] - a[i] == 0) {
            int j = i;
            while(a[j] - a[j-1] == 1) {

            }
        }
    }
    */
    for (int i = 0; i <= n+1; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+2);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = true;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i+1] - res[i] < 3) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                a[i+1] = a[i+1] + 1;
                used[a[i+1]] = 1;
            }
        }
    }
    for (int i = 0; i <= n+1; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+1);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = true;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i] + 1 == res[i+1]) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    used[0] = 1;
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                a[i+1] = a[i+1] + 1;
                used[a[i+1]] = 1;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> used(n+2);
    set <int> s;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s.insert(a[i]);
        used[a[i]] = 1;
    }
    int minRes = 0;
    vector <int> res;
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 1; i < res.size()-1; i++) {
        if (res[i] == -1) continue;
        if (res[i-1] + 1 == res[i] && res[i] + 1 == res[i+1]) {
            res[i-1] = -1;
            res[i] = -1;
            res[i+1] = -1;
            minRes++;
        }
    }
    s.clear();
    for (int i = 0; i < res.size(); i++) {
        if (res[i] != -1) {
            s.insert(res[i]);
        }
    }
    res.clear();
    for (auto it = s.begin(); it != s.end(); it++) {
        res.push_back(*it);
    }
    for (int i = 0; i < res.size(); i++) {
        if (i == res.size() - 1) {
            if (res[i] != -1) minRes++;
            break;
        }
        if (res[i] == -1) continue;
        if (res[i+1] - res[i] < 3) {
            res[i+1] = -1;
            minRes++;
        } else {
            minRes++;
        }
    }

    s.clear();
    res.clear();
    int maxRes = 0;
    sort(a.begin(), a.end());
    for (int i = 0; i < n-1; i++) {
        if (a[i] == a[i+1]) {
            if (used[a[i] - 1] == 0) {
                a[i] = a[i] - 1;
                used[a[i]] = 1;
            } else {
                //a[i+1] = a[i+1] + 1;
                used[a[i+1] + 1] = 1;
                int j = i+1;
                while(j < n && a[j] == a[i]) {
                    a[j] = a[i] + 1;
                    j++;
                }
                i = j - 2;
            }
        }
    }
    for (int i = 1; i < n-1; i++) {
        if (a[i] - a[i-1] == 1 && a[i+1] - a[i] == 0) {
            maxRes++;
        }
    }

    for (int i = 0; i <= n+1; i++) {
        if (used[i] == 1) {
            maxRes++;
        }
    }
    cout << minRes << " " << maxRes;

}


#include<bits/stdc++.h>
#define  p5         100005
#define  p6         1000007
#define  PI         acos(-1)
#define  M          1000000007
#define  sc         scanf
#define  ss         second
#define  ff         first
#define  pf         printf
#define  scin(x)    sc("%d",&x)
#define  scin2(x,y) sc("%d%d",&x,&y)
#define  READ(f)    freopen(f, "r", stdin)
#define  WRITE(f)   freopen(f, "w", stdout)
#define  ll         long long
#define  pp         pair < int, int>
#define  pq         priority_queue
#define  pb         push_back
#define OK          pf("Yes\n")
#define _OK         pf("No\n")
//int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
//int dx[5] = {1, -1, 0, 0 };
//int dy[5] = {0, 0, 1, -1};
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    ll n,i,j,k;
    cin>>n;
    ll ar[n];
    for(i=0; i<n; i++)
    {
        cin>>ar[i];
    }
    sort(ar,ar+n);
    set<ll>s1,s2;
    set<ll>::iterator it;
    for(i=0; i<n; i++)
    {
        if(s1.find(ar[i]-1)!=s1.end())
            s1.insert(ar[i]-1);
        else if(s1.find(ar[i])!=s1.end())
            s1.insert(ar[i]);
        else
            s1.insert(ar[i]+1);
    }
     for(i=0; i<n; i++)
    {
        if(s2.find(ar[i]-1)==s2.end())
            s2.insert(ar[i]-1);
        else if(s2.find(ar[i])==s2.end())
            s2.insert(ar[i]);
        else
            s2.insert(ar[i]+1);
    }
    cout<<s1.size()<<" "<<s2.size()<<endl;
    return 0;
}


#include <bits/stdc++.h>

#define se second
#define sz(x) (int)(x.size())
#define ll long long
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define pb push_back
#define mp make_pair
#define fi first
#define ull unsigned ll

#define pi 3.14159265358979

using namespace std;

const int N = (int)(1e6) + 322;
const ll INF = 2e18 + 17;
const int inf = 2e9;
const int mod = 1000000007;
const double eps = 1e-9;

int gcd(int a, int b) { return b ? gcd (b, a % b) : a; }

int nbr_bits(int a){
	return log2(a)+1;
}

int fastpow(int a, int n, int mod) {
    if(n==0)
    	return 1;
    if(n%2==0){
    	int res = fastpow(a,n/2,mod);
    	res*=res;
    	res%=mod;
    	return res;
	}
	int res = (fastpow(a,n-1,mod)*a)%mod;
	return res;

}

// ----------------------------------------------------

signed main()
{

	int n;
	cin >>  n ;

	set<int> dis;
	int fr[n+1];
	rep(i,1,n) {
		cin >> fr[i] ;
		dis.insert(fr[i]);
	}

	sort(fr+1,fr+n+1);

	int mn = dis.size(),cp=0;
	vector<int> ch;
	ch.pb(fr[1]);
	rep(i,2,n){
		if(fr[i]!=fr[i-1]) ch.pb(fr[i]);
	}
	rep(i,0,ch.size()-1) {
		if(ch[i]==ch[i+1]-1  && ch[i]==ch[i+2]-2){
			mn-=2;
			i+=2;
		}
		else if(ch[i]==ch[i+1]-1){
			mn--;
			i++;
		}
	}

	cout << mn << " " ;

	int mx=dis.size(); set<int> all;
	fr[1]--;
	all.insert(fr[1]);
	rep(i,2,n){
		if(  all.count(fr[i]-1)==0 ){
			all.insert(fr[i]-1);
		}
		else if(  all.count(fr[i]+1)==0 ){
			all.insert(fr[i]+1);
		}
		else all.insert(fr[i]);
	}

	cout << all.size() << endl;

	return 0;
}


#include <bits/stdc++.h>

#define se second
#define sz(x) (int)(x.size())
#define ll long long
#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define pb push_back
#define mp make_pair
#define fi first
#define ull unsigned ll

#define pi 3.14159265358979

using namespace std;

const int N = (int)(1e6) + 322;
const ll INF = 2e18 + 17;
const int inf = 2e9;
const int mod = 1000000007;
const double eps = 1e-9;

int gcd(int a, int b) { return b ? gcd (b, a % b) : a; }

int nbr_bits(int a){
	return log2(a)+1;
}

int fastpow(int a, int n, int mod) {
    if(n==0)
    	return 1;
    if(n%2==0){
    	int res = fastpow(a,n/2,mod);
    	res*=res;
    	res%=mod;
    	return res;
	}
	int res = (fastpow(a,n-1,mod)*a)%mod;
	return res;

}

// ----------------------------------------------------

signed main()
{

	int n;
	cin >>  n ;

	set<int> dis;
	int fr[n+1];
	rep(i,1,n) {
		cin >> fr[i] ;
		dis.insert(fr[i]);
	}

	sort(fr+1,fr+n+1);

	int mn = dis.size();
	rep(i,1,n){
		if(fr[i]==fr[i+1]-1) mn--;
	}

	cout << mn << " " ;

	int mx=dis.size(); set<int> all;
	fr[1]--; fr[n]++;
	rep(i,1,n){
		if( all.count(fr[i])==1 && all.count(fr[i]-1)==0 ){
			all.insert(fr[i]-1);
		}
		else if( all.count(fr[i])==1 && all.count(fr[i]+1)==0 ){
			all.insert(fr[i]+1);
		}
		else all.insert(fr[i]);
	}

	cout << all.size() << endl;

	return 0;
}