#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    int n;
    cin >> n;
    int a[n];
    vector<int> v(n + 4, 0);
    vector<int> b(n + 4, 0);
    vector<int> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

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

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
        if (b[i] > 0)
        {
            if (c[i] == b[i])
            {
                if (b[i - 1] > 0)
                {
                    b[i - 1] += c[i];
                    b[i] -= c[i];
                }
                else if (b[i + 1] > 0)
                {
                    // cout << "i " << i << " else " << endl;
                    b[i + 1] += c[i];
                    b[i] -= c[i];
                }
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
      //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
        if (b[i] > 0)
            m1++;
    }
  //  cout << endl;
    // for (int i = 0; i <= n + 1; i++)
    // {
    //     cout << b[i] << " ";
    // }
    // cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i-1]>=1&&arr[i+1]>=1&&arr[i]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(mn[i-1]>=1&&arr[i]>=1){
			mn[i]=1;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i+1]=1;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1&&arr[i+2]>=1){
			arr[i]=0;
			arr[i+2]=0;
			mn[i]=1;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			return cnt;
		}
	}
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	i=1;
	st=1,ed=1;
	while(i<SIZE){
		// ll pst=st,pcnt=cnt;
		ll cnt=find_seg(i);
		// cout<<st<<" "<<ed<<" "<<cnt<<endl;
		if(cnt>0){
			if(cnt>ed-st+2){
				mx[st-1]=1;
				mx[ed+1]=1;
			}
			else if(cnt==ed-st+2){
				if(mx[st-1]==1){
					mx[ed+1]=1;
				}
				else{
					mx[st-1]=1;
				}
			}
			i=ed+2;
		}
		else{
			break;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]>=1){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			break;
		}
	}
	return cnt;
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	i=1;
	st=1,ed=1;
	while(i<SIZE){
		// ll pst=st,pcnt=cnt;
		ll cnt=find_seg(i);
		// cout<<st<<" "<<ed<<" "<<cnt<<endl;
		if(cnt>0){
			if(cnt>ed-st+2){
				mx[st-1]=1;
				mx[ed+1]=1;
			}
			else if(cnt==ed-st+2){
				if(mx[st-1]==1){
					mx[ed+1]=1;
				}
				else{
					mx[st-1]=1;
				}
			}
			i=ed+2;
		}
		else{
			break;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1&&arr[i+2]>=1){
			arr[i]=0;
			arr[i+2]=0;
			mn[i+1]=1;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]>=1){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			return cnt;
		}
	}
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	i=1;
	st=1,ed=1;
	while(i<SIZE){
		// ll pst=st,pcnt=cnt;
		ll cnt=find_seg(i);
		cout<<st<<" "<<ed<<" "<<cnt<<endl;
		if(cnt>0){
			if(cnt>ed-st+2){
				mx[st-1]=1;
				mx[ed+1]=1;
			}
			else if(cnt==ed-st+2){
				if(mx[st-1]==1){
					mx[ed+1]=1;
				}
				else{
					mx[st-1]=1;
				}
			}
			i=ed+2;
		}
		else{
			break;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i-1]>=1&&arr[i+1]>=1&&arr[i]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(mn[i-1]>=1&&arr[i]>=1){
			mn[i]=1;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i+1]=1;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			return cnt;
		}
	}
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	ll i=1;
	st=1,ed=1;
	while(i<SIZE){
		// ll pst=st,pcnt=cnt;
		ll cnt=find_seg(i);
		// cout<<st<<" "<<ed<<" "<<cnt<<endl;
		if(cnt>0){
			if(cnt>ed-st+2){
				mx[st-1]=1;
				mx[ed+1]=1;
			}
			else if(cnt==ed-st+2){
				if(mx[st-1]==1){
					mx[ed+1]=1;
				}
				else{
					mx[st-1]=1;
				}
			}
			i=ed+2;
		}
		else{
			break;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]>=1){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			return cnt;
		}
	}
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	i=1;
	st=1,ed=1;
	// while(i<SIZE){
	// 	// ll pst=st,pcnt=cnt;
	// 	ll cnt=find_seg(i);
	// 	cout<<st<<" "<<ed<<" "<<cnt<<endl;
	// 	if(cnt>0){
	// 		if(cnt>ed-st+2){
	// 			mx[st-1]=1;
	// 			mx[ed+1]=1;
	// 		}
	// 		else if(cnt==ed-st+2){
	// 			if(mx[st-1]==1){
	// 				mx[ed+1]=1;
	// 			}
	// 			else{
	// 				mx[st-1]=1;
	// 			}
	// 		}
	// 		i=ed+2;
	// 	}
	// 	else{
	// 		break;
	// 	}
	// }
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	ll mncnt=0,mxcnt=0;
	for(i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
ll st,ed;

ll find_seg(ll s){
	ll cnt=0;
	for(ll i=s;i<SIZE;++i){
		if(arr[i]>0){
			st=i;
			while(i<SIZE&&arr[i]){
				cnt+=arr[i];
				mx[i]=1;
				i++;
			}
			ed=i-1;
			return cnt;
		}
	}
}
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,i;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;

	for(i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=1;
			i=i+2;
		}
	}
	i=1;
	st=1,ed=1;
	while(i<SIZE){
		// ll pst=st,pcnt=cnt;
		ll cnt=find_seg(i);
		// cout<<st<<" "<<ed<<" "<<cnt<<endl;
		if(cnt>0){
			if(cnt>ed-st+2){
				mx[st-1]=1;
				mx[ed+1]=1;
			}
			else if(cnt==ed-st+2){
				if(mx[st-1]==1){
					mx[ed+1]=1;
				}
				else{
					mx[st-1]=1;
				}
			}
			i=ed+2;
		}
		else{
			break;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1&&arr[i+2]>=1){
			arr[i]=0;
			arr[i+2]=0;
			mn[i+1]=1;
			i++;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	// for(ll i=0;i<SIZE;++i){
	// 	if(arr[i]){
	// 		cout<<i<<","<<arr[i]<<" ";
	// 	}
	// }
	// cout<<endl;
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i-1]!=1){
				mx[i-1]=1;
			}
			else if(mx[i-1]==1&&mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1&&arr[i+1]>=1&&arr[i+2]>=1){
			mn[i+1]=1;
			arr[i]=0;
			arr[i+2]=0;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i]=1;
			arr[i+1]=0;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=1){
			mn[i]=0;
			mn[i+1]=1;
			mn[i+2]=0;
			i++;
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 200005
ll arr[SIZE];
ll mn[SIZE];
ll mx[SIZE];
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	for(ll i=0;i<n;++i){
		ll e;
		cin>>e;
		arr[e]++;
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i]>=3){
			mx[i-1]=1;
			mx[i]=1;
			mx[i+1]=1;
		}
		if(arr[i]==2){
			if(mx[i-1]==0){
				mx[i-1]=1;
				mx[i]=1;
			}
			else{
				mx[i+1]=1;
				mx[i]=1;
			}
		}
		if(arr[i]==1){
			// cout<<i<<endl;
			if(mx[i]==1){
				mx[i+1]=1;
			}
			else{
				mx[i]=1;
			}
		}
	}
	for(ll i=1;i<SIZE-2;++i){
		if(arr[i-1]>=1&&arr[i+1]>=1&&arr[i]>=1){
			mn[i]=1;
		}
		else if(mn[i-1]>=1&&arr[i]>=1){
			mn[i]=1;
		}
		else if(arr[i]>=1&&arr[i+1]>=1){
			mn[i+1]=1;
		}
		else if(arr[i]>=1){
			mn[i]=1;
		}
	}
	ll mncnt=0,mxcnt=0;
	for(ll i=0;i<SIZE;++i){
		if(mn[i]>0){
			// cout<<i<<" ";
			mncnt++;
		}
		if(mx[i]>0){
			// cout<<i<<" ";
			mxcnt++;
		}
	}
	cout<<mncnt<<" "<<mxcnt<<endl;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=5e4+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	sort(arr+1,arr+1+n);

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}

	arr[1]--;
	int ans=1;
	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
				tp=arr[i];
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;

	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}

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

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}
	int i=1;
	arr[1]--;
	int ans=1;

	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			if(i==2) i+=num_arr[arr[i]]-3;
			else i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	ans=1;
	for(int i=2;i<=n;++i){
		if(arr[i]!=arr[i-1])
		ans++;
	}
	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int s[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		s[arr[i]]++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	for(int i =1;i<=n;i++){
        if(s[i] != 0){
            ansf++;
            i+=2;
        }
    }
	sort(arr+1,arr+1+n);

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	int i=1;
	arr[1]--;
	int ans=1;

	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			if(i==2) i+=num_arr[arr[i]]-3;
			else i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	ans=1;
	for(int i=2;i<=n;++i){
		if(arr[i]!=arr[i-1])
		ans++;
	}
	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int s[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		s[arr[i]]++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	for(int i =1;i<=n;i++){
        if(s[i] != 0){
            ansf++;
            i+=2;
        }
    }
	int ans=0;
    for(int i = 1;i<=n+1;i++){
        if(s[i]==0 ) continue;
        if(s[i-1]==0 ){
            s[i]--;
            s[i-1]++;
        }
        if(s[i]>1){
            s[i+1]++;
            s[i]--;
        }
    }
	for(int i = 0;i<=n+1;i++){
        if(s[i]!=0) ans++;
    }
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=5e4+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	sort(arr+1,arr+1+n);

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}

	arr[1]--;
	int ans=1;
	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
				tp=arr[i];
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;

	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int s[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		s[arr[i]]++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	for(int i =1;i<=n;i++){
        if(s[i] != 0){
            ansf++;
            i+=2;
        }
    }
	int ans=0;
    for(int i = 1;i<=n+1;i++){
        if(s[i]==0 ) continue;
        if(s[i-1]==0 ){
            s[i]--;
            s[i-1]++;
        }
        if(s[i]>1){
            s[i+1]++;
            s[i]--;
        }
    }
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=5e4+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	sort(arr+1,arr+1+n);

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}

	arr[1]--;
	int ans=1;
	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
				tp=arr[i];
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;/*
	for(int i=1;i<=n;++i){
		cout<<arr[i]<<" ";
	}cout<<endl;
	*/
	ans=1;
	for(int i=2;i<=n;++i){
		if(arr[i]!=arr[i-1])
		ans++;
	}
	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		//if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}
	for(int i = 1;i<=n;i++){
        if(arr[i] != 0){
            ansf++;
            i+=2;
        }
    }
	sort(arr+1,arr+1+n);

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}
	int i=1;
	arr[1]--;
	int ans=1;

	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			if(i==2) i+=num_arr[arr[i]]-3;
			else i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	ans=1;
	for(int i=2;i<=n;++i){
		if(arr[i]!=arr[i-1])
		ans++;
	}
	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=5e4+111;

int arr[maxn];
int flag[maxn]={0};
int num_arr[maxn]={0};
int main(){
	int n;
	scanf("%d",&n);
	if(n==1) {
		printf("1 1\n");
		return 0;
	}
	int ansf=0;
	for(int i=1;i<=n;++i){
		scanf("%d",arr+i);
		if(!num_arr[arr[i]]) ansf++;
		++num_arr[arr[i]];
		if(num_arr[arr[i]]>2) flag[arr[i]]=1;
	}

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

	int num_solve=0,solve[maxn]={0};
	int tep=1;
	for(int i=2;i<=n;++i){
		if(arr[i]==arr[i-1]+1) ++tep;
		if(arr[i]-arr[i-1]>1||i==n) {
			if(tep>1) solve[++num_solve]=tep;
			tep=1;
		}
	}
	for(int i=1;i<=num_solve;++i){
		int a=solve[i]/3;
		int b=solve[i]%3/2;
		int c=solve[i]%3%2;
		ansf-=solve[i]-a-b-c;
	}
	int i=1;
	arr[1]--;
	int ans=1;

	for(int i=2;i<=n-1;++i){
		int tp=arr[i];
		if(arr[i]-1!=arr[i-1]&&arr[i]!=arr[i-1]) {
			--arr[i];
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
		}
		if(arr[i]==arr[i-1]) {
			++arr[i];
			num_arr[arr[i]]++;
			num_arr[tp]--;
			if(num_arr[tp]<=2&&flag[tp]==1) flag[tp]=0;
			if(num_arr[arr[i]]>2&&flag[tp]==0) {
				flag[arr[i]]=1;
			}
		}
		if(arr[i]!=arr[i-1]) ans++;
		if(num_arr[arr[i]]>2&&flag[arr[i]]==1) {
			flag[arr[i]]=-1;
			if(i==2) i+=num_arr[arr[i]]-3;
			else i+=num_arr[arr[i]]-2;
			if(arr[i+1]!=arr[i]) ++ans;
		}
	}
	arr[n]++;
	ans++;
	// for(int i=1;i<=n;++i){
	// 	cout<<arr[i]<<" ";
	// }cout<<endl;

	ans=1;
	for(int i=2;i<=n;++i){
		if(arr[i]!=arr[i-1])
		ans++;
	}
	printf("%d %d\n",ansf,ans);
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (it.second <=1)
            continue;
        if (mp2[it.first - 1]==0)
        {
            maxn++;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second > 1 && mp2[it.first+1]==0)
        {
            maxn++;
            mp2[it.first + 1]++;
            it.second--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0 && it.first>1)
        {
            if(it.second>1)
                maxn++;
            mp2[it.first]--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1]==0)
        {
            maxn++;
            mp2[it.first + 1]++;
            mp2[it.first]--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0)
        {
            maxn++;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1])
        {
            maxn++;
            mp2[it.first + 1]++;
            it.second--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0 && it.first>1)
        {
            maxn++;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1])
        {
            maxn++;
            mp2[it.first + 1]++;
            it.second--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0 && it.first>1)
        {
            if(it.second>1)
                maxn++;
            mp2[it.first]--;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1]==0)
        {
            maxn++;
            mp2[it.first + 1]++;
            mp2[it.first]--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0 && it.first>1)
        {
            if(it.second>1)
                maxn++;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1]==0 && it.first+1<=n)
        {
            maxn++;
            mp2[it.first + 1]++;
            it.second--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}
int a[N];
int main()
{
    int n, minn = 0, maxn = 0;
    cin >> n;
    rep(i, 1, n)
        cin >> a[i];
    rep(i, 1, n)
        if (a[i])
            i += 2,minn++;
    rep(i, 0, n)
    {
        if (a[i] == 0 && a[i + 1])
            a[i]++, a[i + 1]--;
        else if (a[i] > 1)
            a[i]--, a[i + 1]++;
    }
    rep(i, 0, n + 1)
        if (a[i])
            maxn++;
    cout << minn << " " << maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}
int a[N];
int main()
{
    int n, minn = 0, maxn = 0;
    cin >> n;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        a[t]++;
    }

    rep(i, 1, n)
        if (a[i])
            i += 2,minn++;
    rep(i, 0, n)
    {
        if (a[i] == 0 && a[i + 1])
            a[i]++, a[i + 1]--;
        else if (a[i] > 1)
            a[i]--, a[i + 1]++;
    }
    rep(i, 0, n + 1)
        if (a[i])
            maxn++;
    cout << minn << " " << maxn << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e5 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x%mod)+(y%mod))%mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x %mod) * (y % mod))%mod;
}
inline int Inv(int x) {
    return qpow(x, mod - 2);
}

int main()
{
    int n;
    cin >> n;
    map<int, int> mp1,mp2;
    rep(i, 1, n)
    {
        int t;
        cin >> t;
        mp1[t]++;
        mp2[t]++;
    }
    int maxn = 0, minn = 0,res=mp1.size();
    for (auto it : mp1)
    {
        if (it.second == 0)
            continue;
        if (mp1[it.first - 1])
        {
            minn++;
            mp1[it.first - 1] = 0;
            if (mp1[it.first + 1])
                mp1[it.first + 1] = 0,minn++;
        }
    }
    for (auto it : mp2)
    {
        if (mp2[it.first - 1]==0 && it.first>1)
        {
            if(it.second>1)
                maxn++;
            it.second--;
            mp2[it.first - 1]++;
        }
        if (it.second>1 && mp2[it.first+1]==0)
        {
            maxn++;
            mp2[it.first + 1]++;
            it.second--;
        }
    }
    cout << res - minn << " " << res + maxn << endl;
    return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ; bool g[n+10] = {} ;

	vii v;
	rep(i,0,n) {
		int t; cin >> t ;
		g[t] = 1 ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ;

	for(int i = 0 ; i <= n ; ++i) {
		if(g[i]) ++mn , i+=2 ;
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+10]={} ; bool g[n+10] = {} ;

	vii v;
	rep(i,0,n) {
		int t; cin >> t ;
		g[t] = 1 ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
	}

	sort(all(v)) ;

	int mx = 0 ;

	set<int> s;

	bool hh[n+10] = {} ;

	for(auto i : v) {
		if(!hh[i-1]) hh[i-1] = 1 , s.ins(i-1);
		else if(!hh[i]) hh[i] =1, s.ins(i) ;
		else if(!hh[i+1]) hh[i+1] = 1, s.ins(i+1) ;
	}

	int mn = 0 ;

	for(int i = 0 ; i <= n ; ++i) {
		if(g[i]) ++mn , i+=2 ;
	}

	cout << mn << " " << sz(s) ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ; bool g[n+10] = {} ;

	vii v;
	rep(i,0,n) {
		int t; cin >> t ;
		g[t] = 1 ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ;

	for(int i = 0 ; i <= n ; ++i) {
		if(g[i]) {
			// cout << i << " " ;
			++mn ;
			if(g[i+1]) {
				++i ;
				if(g[i+1]) ++i ;
			}
		}
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v) ; ++i) {
		if(h[v[i]]==1) ++mx ;
		else if(h[v[i]]==2) {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			else {
				if(!h[v[i]+1]) ++mx , ++h[v[i]+1] ;
			}
			++i;
		}
		else {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			if(!h[v[i]+1]) ++mx , h[v[i]+1]++ ;
			i+=2;
		}
	}

	int mn = 0 ; bool f = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		auto it = i ; ++it;
		if(it!=s.end()) {
			++mn;
			if(*it - *i > 1) continue;
			auto itt = it ;
			++itt;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
					if(itt == --(--s.end())) ++mn;
				}
				else i = it;
			}
		}
	}

	if(sz(s)==1) ++mn ;
	else if(*s.rbegin() - *(++s.rbegin()) > 1) ++mn ;

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ; bool g[n+10] = {} ;

	vii v;
	rep(i,0,n) {
		int t; cin >> t ;
		g[t] = 1 ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ;

	for(int i = 0 ; i < n ; ++i) {
		++mn ;
		if(g[i]) {
			if(g[i+1] or g[i+2]) i += 2;
			else ++i ;
		}
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ; bool g[n+10] = {} ;

	vii v;
	rep(i,0,n) {
		int t; cin >> t ;
		g[t] = 1 ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ;

	for(int i = 0 ; i < n ; ++i) {
		++mn ;
		if(g[i]) {
			if(g[i+1] and g[i+2]) i += 2;
			else ++i ;
		}
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ; bool f = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		++mn ;
		auto it = i ; ++it;
		if(it!=s.end()) {
			if(*it != *i + 1) continue;
			i = it ;
			auto itt = it ;
			++itt;
			if(itt!=s.end()) {
				if(*it +1==*itt) {
					i = itt ;
				}
			}
		}
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	if(n==1) {
		cout <<1 << " " << 1 ; return ;
	}

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v) ; ++i) {
		if(h[v[i]]==1) ++mx ;
		else if(h[v[i]]==2) {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			else {
				if(!h[v[i]+1]) ++mx , ++h[v[i]+1] ;
			}
			++i;
		}
		else {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			if(!h[v[i]+1]) ++mx , h[v[i]+1]++ ;
			i+=2;
		}
	}

	int mn = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		auto it = i ; ++it;
		if(it!=s.end()) {
			if(*it - *i > 1) {++mn; continue;}
			auto itt = it ;
			++itt;
			++mn ;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
				}
				else i = it;
			}
		}
	}

	if(*s.rbegin() - *(++s.rbegin()) > 1) ++mn ;

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v) ; ++i) {
		if(h[v[i]]==1) ++mx ;
		else if(h[v[i]]==2) {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			else {
				if(!h[v[i]+1]) ++mx , ++h[v[i]+1] ;
			}
			++i;
		}
		else {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			if(!h[v[i]+1]) ++mx , h[v[i]+1]++ ;
			i+=2;
		}
	}

	int mn = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		auto it = i ; ++it;
		if(it!=s.end()) {
			if(*it - *i > 1) {++mn; continue;}
			auto itt = it ;
			++itt;
			++mn ;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
				}
				else i = it;
			}
		}
	}

	if(sz(s)==1) ++mn ;
	else if(*s.rbegin() - *(++s.rbegin()) > 1) ++mn ;

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ; bool f = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		++mn ;
		auto it = i ; ++it;
		if(it!=s.end()) {
			if(*it - *i > 1) continue;
			auto itt = it ;
			++itt;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
				}
				else i = it;
			}
			else i = it ;
		}
	}

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v)-1 ; ++i) {
		if(h[v[i]]==1) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]] ;
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]];
		}
		else if(h[v[i]]==2) {
			if(!h[v[i]-1]) ++h[v[i]-1] , --h[v[i]];
			else if(!h[v[i]+1]) ++h[v[i]+1] , --h[v[i]] ;
			++i;
		}
		else {
			++h[v[i]-1] , --h[v[i]] , ++h[v[i]+1] ;
			i+=2;
		}
	}

	rep(i,0,n+2) if(h[i]) ++mx ;

	int mn = 0 ; bool f = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		auto it = i ; ++it;
		if(it!=s.end()) {
			++mn;
			if(*it - *i > 1) continue;
			auto itt = it ;
			++itt;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
					if(itt == --(--s.end())) ++mn;
				}
				else i = it;
			}
		}
	}

	if(sz(s)==1) ++mn ;
	else if(*s.rbegin() - *(++s.rbegin()) > 1) ++mn ;

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple

#define int long long

const int MOD = (int) 1e9 + 7 ;
const int mod = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	int n; cin >> n ;
	int h[n+2]={} ;

	vii v;
	set<int> s;
	rep(i,0,n) {
		int t; cin >> t ;
		if(h[t]<3) {
			++h[t]; v.eb(t) ;
		}
		s.ins(t) ;

	}

	sort(all(v)) ;

	int mx = 0 ;

	for(int i = 0 ; i<sz(v) ; ++i) {
		if(h[v[i]]==1) ++mx ;
		else if(h[v[i]]==2) {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			else {
				if(!h[v[i]+1]) ++mx , ++h[v[i]+1] ;
			}
			++i;
		}
		else {
			++mx ;
			if(!h[v[i]-1]) ++mx;
			if(!h[v[i]+1]) ++mx , h[v[i]+1]++ ;
			i+=2;
		}
	}

	int mn = 0 ;

	for(auto i = s.begin() ; i!=s.end() ; ++i) {
		auto it = i ; ++it;
		if(it!=s.end()) {
			if(*it - *i > 1) {++mn; continue;}
			auto itt = it ;
			++itt;
			++mn ;
			if(itt!=s.end()) {
				if(*i + 1 == *it and *it +1==*itt) {
					i = itt ;
				}
				else i = it;
			}
		}
	}

	if(*s.rbegin() - *(++s.rbegin()) > 1) ++mn ;

	cout << mn << " " << mx ;
}

int32_t main() {

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,0,t) {
		solve() ;
	}

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	vector<ll> amount(n+2);
	amount[n+1] = -20;
	ll h = 0, h_ma=0, h_mi=0;
	ll mi = 1e18;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi = min(mi, v[i]);
		amount[v[i]]++;
		if(amount[v[i]] == 1){
			h++;
			h_ma++;
			h_mi++;
		}
	}
	ll prev = mi-2;
	for(int i=0;i<=n;i++){
		if(amount[i]){
			if(prev+1 == i){
				h_mi--;
			}
			else{
				prev = i;
			}
		}
		else{
			if(i){
				if(amount[i-1]>1){
					h_ma++;
					amount[i-1]--;
				}
			}
			if(amount[i+1]>1){
				h_ma++;
				amount[i+1]--;
			}
		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	ll h_mi = 0, h_ma = 0;
	for(int i=1;i<=n;i++){
		ll item;
		cin>>item;
		v[item]++;
		if(v[item] == 1){
			h_mi++;
			h_ma++;
		}
	}
	ll cnt = 0, len=0, start = -1, end = -1;
	vector<pair<ll, ll> > seg;
	vector<ll> cost;
	seg.push_back({-2, -2});
	cost.push_back(1);
	for(int i=1;i<=n;i++){
		if(v[i]){
			cnt++;
			if(cnt == 1){
				start = i;
				end = i;
			}
			else{
				end++;
			}
			len+=v[i];
		}
		else{
			if(start != -1){
				ll k = cnt/3 + bool(cnt%3);
				cnt-=k;
				h_mi-=cnt;
				seg.push_back({start, end});
				//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
		}
	}
	if(cnt){
			if(start != -1){
				ll k = cnt/3 + bool(cnt%3);
				cnt-=k;
				h_mi-=cnt;
				seg.push_back({start, end});
				//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
	}
	seg.push_back({MAX, MAX});
	cost.push_back(0);
	for(int i=1;i<seg.size()-1;i++){
		if(seg[i].first - seg[i-1].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"left for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].first--;

		}
		if(seg[i+1].first - seg[i].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"right for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].second++;

		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	vector<ll> amount(n+2);
	amount[n+1] = -20;
	ll h = 0, h_ma=0, h_mi=0;
	ll mi = 1e18;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi = min(mi, v[i]);
		amount[v[i]]++;
		if(amount[v[i]] == 1){
			h++;
			h_ma++;
			h_mi++;
		}
	}
	//cout<<"h "<<h_mi<<endl;
	ll tmp = 0;
	for(int i=0;i<=n;i++){
		if(amount[i]){
			//cout<<"house "<<i<<endl;
			tmp++;
		}
		else{
			if(i){
				if(amount[i-1]>1){
					h_ma++;
					amount[i-1]--;
				}
			}
			if(amount[i+1]>1){
				h_ma++;
				amount[i+1]--;
			}
			if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			}
			tmp=0;
		}
		//cout<<h_mi<<endl;
	}
	if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			tmp=0;
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	ll h_mi = 0, h_ma = 0;
	for(int i=1;i<=n;i++){
		ll item;
		cin>>item;
		v[item]++;
		if(v[item] == 1){
			h_mi++;
			h_ma++;
		}
	}
	ll cnt = 0, len=0, start = 0, end = 0;
	vector<pair<ll, ll> > seg;
	vector<ll> cost;
	seg.push_back({-2, -2});
	cost.push_back(1);
	for(int i=1;i<=n;i++){
		if(v[i]){
			cnt++;
			if(cnt == 1){
				start = i;
				end = i;
			}
			else{
				end++;
			}
			len+=v[i];
		}
		else{
			if(start != -1){
				cnt = cnt-(cnt/3 + bool(cnt%3));
				h_mi-=cnt;
				seg.push_back({start, end});
			//	cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
		}
	}
	if(cnt){
			cnt = cnt - (cnt/3 + bool(cnt%3));
			h_mi-=cnt;
			seg.push_back({start, end});
			//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
			cost.push_back(len);
			cnt = 0;
			len = 0;
	}
	seg.push_back({MAX, MAX});
	cost.push_back(0);
	for(int i=1;i<seg.size();i++){
		if(seg[i].first - seg[i-1].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"left for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].first--;

		}
		if(seg[i+1].first - seg[i].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"right for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].second++;

		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	vector<ll> amount(n+3);
	amount[n+1] = 0;
	ll h = 0, h_ma=0, h_mi=0;
	ll mi = 1e18;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi = min(mi, v[i]);
		amount[v[i]]++;
		if(amount[v[i]] == 1){
			h++;
			h_ma++;
			h_mi++;
		}
	}
	//cout<<"h "<<h_mi<<endl;
	ll tmp = 0;
	for(int i=0;i<=n+1;i++){
		if(amount[i]){
			//cout<<"house "<<i<<endl;
			tmp++;
		}
		else{
			if(i){
				if(amount[i-1]>1 and !amount[i]){
					h_ma++;
					amount[i-1]--;
					amount[i]++;
				}
			}
			if(amount[i+1]>1 and !amount[i]){
				h_ma++;
				amount[i+1]--;
				amount[i]++;
			}
			if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			}
			tmp=0;
		}
		//cout<<h_mi<<endl;
	}
	if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			tmp=0;
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	ll h_mi = 0, h_ma = 0;
	for(int i=1;i<=n;i++){
		ll item;
		cin>>item;
		v[item]++;
		if(v[item] == 1){
			h_mi++;
			h_ma++;
		}
	}
	ll cnt = 0, len=0, start = 0, end = 0;
	vector<pair<ll, ll> > seg;
	vector<ll> cost;
	seg.push_back({-2, -2});
	cost.push_back(1);
	for(int i=1;i<=n;i++){
		if(v[i]){
			cnt++;
			if(cnt == 1){
				start = i;
				end = i;
			}
			else{
				end++;
			}
			len+=v[i];
		}
		else{
			if(start != -1){
				ll k = cnt/3 + bool(cnt%3);
				cnt-=k;
				h_mi-=cnt;
				seg.push_back({start, end});
				//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
		}
	}
	if(cnt){
			ll k = cnt/3 + bool(cnt%3);
			cnt-=k;
			h_mi-=cnt;
			//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
			seg.push_back({start, end});
			cost.push_back(len);
			cnt = 0;
			len = 0;
	}
	seg.push_back({MAX, MAX});
	cost.push_back(0);
	for(int i=1;i<seg.size()-1;i++){
		if(seg[i].first - seg[i-1].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"left for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].first--;

		}
		if(seg[i+1].first - seg[i].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"right for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].second++;

		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	vector<ll> amount(n+1);
	ll h = 0, h_ma=0, h_mi=0;
	ll mi = 1e18;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi = min(mi, v[i]);
		amount[v[i]]++;
		if(amount[v[i]] == 1){
			h++;
			h_ma++;
			h_mi++;
		}
	}
	ll prev = mi-2;
	for(int i=0;i<=n;i++){
		if(amount[i]){
			if(prev+1 == i){
				h_mi--;
			}
			else{
				prev = i;
			}
		}
		else{
			if(i){
				if(amount[i-1]>1){
					h_ma++;
					amount[i-1]--;
				}
			}
			if(amount[i+1]>1){
				h_ma++;
				amount[i+1]--;
			}
		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	vector<ll> amount(n+2);
	amount[n+1] = -20;
	ll h = 0, h_ma=0, h_mi=0;
	ll mi = 1e18;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mi = min(mi, v[i]);
		amount[v[i]]++;
		if(amount[v[i]] == 1){
			h++;
			h_ma++;
			h_mi++;
		}
	}
	//cout<<"h "<<h_mi<<endl;
	ll tmp = 0;
	for(int i=0;i<=n;i++){
		if(amount[i]){
			//cout<<"house "<<i<<endl;
			tmp++;
		}
		else{
			if(i){
				if(amount[i-1]>1 and !amount[i]){
					h_ma++;
					amount[i-1]--;
					amount[i]++;
				}
			}
			if(amount[i+1]>1 and !amount[i]){
				h_ma++;
				amount[i+1]--;
				amount[i]++;
			}
			if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			}
			tmp=0;
		}
		//cout<<h_mi<<endl;
	}
	if(tmp>1){
			h_mi-=(tmp/2+tmp%2);
			tmp=0;
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

ll MAX = 1e10;
ll MOD = 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	ll h_mi = 0, h_ma = 0;
	for(int i=1;i<=n;i++){
		ll item;
		cin>>item;
		v[item]++;
		if(v[item] == 1){
			h_ma++;
		}
	}
	ll cnt = 0, len=0, start = -1, end = -1;
	vector<pair<ll, ll> > seg;
	vector<ll> cost;
	seg.push_back({-2, -2});
	cost.push_back(1);
	for(int i=1;i<=n;i++){
		if(v[i]){
			cnt++;
			if(cnt == 1){
				start = i;
				end = i;
			}
			else{
				end++;
			}
			len+=v[i];
		}
		else{
			if(start != -1){
				seg.push_back({start, end});
				//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
		}
	}
	if(cnt){
			if(start != -1){
				seg.push_back({start, end});
				//cout<<"add seg - "<<start<<" "<<end<<" len is "<<len<<endl;
				cost.push_back(len);
				cnt = 0;
				start = -1;
				end = -1;
				len = 0;
			}
	}
	seg.push_back({MAX, MAX});
	cost.push_back(0);
	for(int i=1;i<seg.size()-1;i++){
		if(seg[i].first - seg[i-1].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"left for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].first--;

		}
		if(seg[i+1].first - seg[i].second - 1 > 0 and cost[i] > seg[i].second - seg[i].first+1){
			h_ma++;
			//cout<<"right for seg - "<<seg[i].first<<" "<<seg[i].second<<endl;
			seg[i].second++;

		}
	}
	for(int i=0;i<=n;i++){
		if(v[i]){
			h_mi++;
			i+=2;
		}
	}
	cout<<h_mi<<" "<<h_ma;
	return 0;
}