//
//  820B
//

/*
 B. Mister B and Angle in Polygon
 time limit per test: 2 seconds
 memory limit per test: 256 megabytes
 input: standard input
 output: standard output

 On one quiet day all of sudden Mister B decided to draw angle a on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex n-gon (regular convex polygon with n sides).

 That's why Mister B decided to use this polygon. Now Mister B must find three distinct vertices v1, v2, v3 such that the angle (where v2 is the vertex of the angle, and v1 and v3 lie on its sides) is as close as possible to a. In other words, the value should be minimum possible.

 If there are many optimal solutions, Mister B should be satisfied with any of them.

 Input
 First and only line contains two space-separated integers n and a (3 ≤ n ≤ 105, 1 ≤ a ≤ 180) — the number of vertices in the polygon and the needed angle, in degrees.

 Output
 Print three space-separated integers: the vertices v1, v2, v3, which form . If there are multiple optimal solutions, print any of them. The vertices are numbered from 1 to n in clockwise order.

 Examples
 input
 3 15
 output
 1 2 3
 input
 4 67
 output
 2 1 3
 input
 4 68
 output
 4 1 2
 Note
 In first sample test vertices of regular triangle can create only angle of 60 degrees, that's why every possible angle is correct.

 Vertices of square can create 45 or 90 degrees angles only. That's why in second sample test the angle of 45 degrees was chosen, since |45 - 67| < |90 - 67|. Other correct answers are: "3 1 2", "3 2 4", "4 2 3", "4 3 1", "1 3 4", "1 4 2", "2 4 1", "4 1 3", "3 1 4", "3 4 2", "2 4 3", "2 3 1", "1 3 2", "1 2 4", "4 2 1".

 In third sample test, on the contrary, the angle of 90 degrees was chosen, since |90 - 68| < |45 - 68|. Other correct answers are: "2 1 4", "3 2 1", "1 2 3", "4 3 2", "2 3 4", "1 4 3", "3 4 1".
 */

#include <iostream>
using namespace std;

#include <cmath>

int main() {
    //cout << "Hello, World!" << endl;
    int n, a;
    cin >> n >> a;
    double theta = (n - 2)*180/n;
    double beta = theta/(n - 2);
    double thetaD = fabs(theta - a);
    double betaD = fabs(beta - a);
    if (thetaD > betaD) {
        cout << "2 1 3" << endl;
    } else {
        cout << "2 1 " << n << endl;
    }

    return 0;
}


/*
CF ID: Ankit717
PROG: Binary String To Subsequences
LANG: C++
*/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define mod 1000000007
#define maxn 200005
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define pb push_back
#define pf push_front
#define nl cout << "\n";

const ll INF=1e18L+5;

struct Data{
	ll p;
	ll h;
};

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

bool comp(pll &a,pll &b){
	return a.first<b.first;
}

// vector<pll> adj[maxn];
// vector<ll> par;
// vector<bool> vis;

ll gcd(ll a,ll b){
    while(a!=0){
        ll temp=a;
        a = b % a;
        b = temp;
    }

    return b;
}

// bool prime[maxn],near[maxn];
// void sieve(){
// 	f(i,0,maxn+1){
// 		prime[i]=true;
// 	}
// 	prime[0]=falsrime[1]=false;
// 	for(ll i=2;i*i<=maxn;i++){
// 		if(prime[i]){
// 			for(j=i*i;j<=maxn;j+=i){
// 				prime[j]=false;
// 			}
// 		}
// 	}
// }

void solve(){
	ll n;
	ld a;
	cin >> n >> a;

	ld sangle=((double)180)/n,dm=INF;
	ll j;
	f(i,1,n-1){
		if(dm>abs(a-sangle*i)){
			dm=abs(a-sangle*i);
			j=i;
		}
	}
	cout << 1 <<" "<< 2 <<" "<<n-j+1;
}

int main(){
	ini();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	// ll t;
	// cin >> t;
	// f(i,0,t){
		solve();
	//}
}


/*
CF ID: Ankit717
PROG: Binary String To Subsequences
LANG: C++
*/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define mod 1000000007
#define maxn 200005
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define pb push_back
#define pf push_front
#define nl cout << "\n";

const ll INF=1e18L+5;

struct Data{
	ll p;
	ll h;
};

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

bool comp(pll &a,pll &b){
	return a.first<b.first;
}

// vector<pll> adj[maxn];
// vector<ll> par;
// vector<bool> vis;

ll gcd(ll a,ll b){
    while(a!=0){
        ll temp=a;
        a = b % a;
        b = temp;
    }

    return b;
}

// bool prime[maxn],near[maxn];
// void sieve(){
// 	f(i,0,maxn+1){
// 		prime[i]=true;
// 	}
// 	prime[0]=falsrime[1]=false;
// 	for(ll i=2;i*i<=maxn;i++){
// 		if(prime[i]){
// 			for(j=i*i;j<=maxn;j+=i){
// 				prime[j]=false;
// 			}
// 		}
// 	}
// }

void solve(){
	ll n,a;
	cin >> n >> a;

	ll sangle=180/n,j,dm=INF;
	f(i,1,n-1){
		if(dm>abs(a-sangle*i)){
			dm=abs(a-sangle*i);
			j=i;
		}
	}
	cout << 1 <<" "<< 2 <<" "<<n-j+1;
}

int main(){
	ini();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	// ll t;
	// cin >> t;
	// f(i,0,t){
		solve();
	//}
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef vector<long long> vll;

#define PI 3.141592653589793
#define N 1000000009

int main()
{
    IOS;
    ll n,a;
    cin>>n>>a;
    double cur=360/(n);
    double val=cur;
    double ans=abs(cur-a);
    ll id=3;
    cout<<1<<" "<<2<<" ";
    for(ll i=4;i<=n;i++)
    {
        cur-=val/(n-2);
        //ans=min(ans,abs(cur-a));
        if(ans>abs(cur-a))
        {
        	id=i;
        	ans=abs(cur-a);
        }
    }
    cout<<id<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef vector<long long> vll;

#define PI 3.141592653589793
#define N 1000000009

int main()
{
    IOS;
    ll n,a;
    cin>>n>>a;
    double cur=(double)(n-2)*360/(double)n;
    double val=(double)cur/(n-2);
    double ans=abs(cur-a);
    ll id=3;
    cout<<1<<" "<<2<<" ";
    for(ll i=3;i<=n;i++)
    {
        //ans=min(ans,abs(cur-a));
        if(ans>abs(cur-(double)a))
        {
        	id=i;
        	ans=abs(cur-(double)a);
        }
        cur-=val;
    }
    cout<<id<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef vector<long long> vll;

#define PI 3.141592653589793
#define N 1000000009

int main()
{
    IOS;
    ll n,a;
    cin>>n>>a;
    double cur=(double)(n-2)*180/(double)n;
    double val=cur/(double)(n-2);
    double ans=200;
    ll id;
    cout<<1<<" "<<2<<" ";
    for(ll i=3;i<=n;i++)
    {
        //ans=min(ans,abs(cur-a));
        if(ans>abs(cur-(double)a))
        {
        	id=i;
        	ans=abs(cur-(double)a);
        }
        cur-=val;
    }
    cout<<id<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   int n,k;
   scanf("%d %d",&n,&k);
   vector<pair<double,int> >a(n-2);
   a[0].first=((((double)n)-2)*180.0)/((double)n);
   a[n-3].first=(180.0-(a[0].first))/2.0;
   int i,j;
   for(i=n-4,j=2;i>0;i--,j++)
   {
       a[i].first=(a[n-3].first)*j;
   }
   for(i=0,j=3;i<n-3;i++,j++)
   {
       a[i].second=j;
   }
   a[n-3].second=3;
   double diff,mini=100000.0;
   for(i=0;i<n-2;i++)
   {
       diff=abs(((double)k)-a[i].first);
       if(diff<mini)
       {
           j=i;
           mini=diff;
       }

   }
   if(j==(n-3))
   {
    printf("1 3 2");
   }
   else
   {
       printf("1 2 %d",a[j].second);
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   int n,k;
   scanf("%d %d",&n,&k);
   vector<pair<int,int> >a(n-2);
   a[0].first=((n-2)*180)/n;
   a[n-3].first=(180-(a[0].first))/2;
   int i,j;
   for(i=n-4,j=2;i>0;i--,j++)
   {
       a[i].first=((a[n-3].first)*j);
   }
   for(i=0,j=3;i<n-3;i++,j++)
   {
       a[i].second=j;
   }
   a[n-3].second=3;
  int diff,mini=100000;
   for(i=0;i<n-2;i++)
   {
       diff=abs(k-(a[i].first));
       if(diff<mini)
       {
           j=i;
           mini=diff;
       }

   }
   if(j==(n-3))
   {
    printf("1 3 2");
   }
   else
   {
       printf("1 2 %d",a[j].second);
   }
   return 0;
}


#include <bits/stdc++.h>
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);

#define ll long long
#define US unsigned short int
#define MP make_pair
#define FS first
#define SD second
#define MOD (1000000000+7)
#define PLL pair<ll,ll>

#define PB push_back
#define LN cout<<"\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define IN(x) cin>>x
#define INN(x,y) cin>>x>>y
#define OU(y) cout<<y<<" "
#define OUT(x) cout<<x<<"\n"
#define OUTT(x,y) cout<<x<<" "<<y<<"\n"

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define AI(v)           for(ll &tmp:v) cin>>tmp
#define AO(v)           for(ll tmp:v) cout<<tmp<<" "

using namespace std;

int main(){
    double n,a;
    INN(n,a);
    double rate=(((n-2)*180)/n)/(n-2);
    //cout<<rate<<endl;
    double angle=rate;
    double mn=1000000000;
    double indx=0;
    for (double i = 1; i <= n-2; i++)
    {
        if(abs(angle-a)<mn){
            mn=abs(angle-a);
            indx=i+2;
        }
        angle+=rate;
    }
    OU(2);
    OU(1);
    OU(indx);
    LN;
    return 0;
}


#include <bits/stdc++.h>
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);

#define ll long long
#define US unsigned short int
#define MP make_pair
#define FS first
#define SD second
#define MOD (1000000000+7)
#define PLL pair<ll,ll>

#define PB push_back
#define LN cout<<"\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define IN(x) cin>>x
#define INN(x,y) cin>>x>>y
#define OU(y) cout<<y<<" "
#define OUT(x) cout<<x<<"\n"
#define OUTT(x,y) cout<<x<<" "<<y<<"\n"

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define AI(v)           for(ll &tmp:v) cin>>tmp
#define AO(v)           for(ll tmp:v) cout<<tmp<<" "

using namespace std;

int main(){
    ll n,a;
    INN(n,a);
    ll rate=(((n-2)*180)/n)/(n-2);
    ll angle=rate;
    ll mn=1000000000;
    ll indx=0;
    for (ll i = 1; i <= n-2; i++)
    {
        if(abs(angle-a)<mn){
            mn=abs(angle-a);
            indx=i+2;
        }
        angle+=rate;
    }
    OU(2);
    OU(1);
    OU(indx);
    LN;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   ld n,x;
   cin>>n>>x;
   ld mn=1e10;
   int m=2;
   rep(i,3,n){
    ld y=(180*(n-i+1))/n;
    if(abs(y-x)<mn){
      m=i;
      mn=abs(y-x);
    }
   }
   cout<<1<<" "<<2<<" "<<m;
  return 0;
}

signed main(){

    //sublime;
    raftaar;

    solve();

}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   ld n,x;
   cin>>n>>x;
   if(n==3){
    cout<<1<<" "<<2<<" "<<3;
    return 0;
   }
   if(n==4){
    if(abs(90-x)<abs(45-x)){
      cout<<1<<" "<<2<<" "<<3;
      return 0;
    }
    cout<<2<<" "<<1<<" "<<3;
    return 0;
   }
   ld mn=abs(((180*(n-2))/n)-x);
   int m=2;
   rep(i,3,n-2){
    ld y=(180*(n-i))/n;
    if(abs(y-x)<mn){
      m=i;
      mn=abs(y-x);
    }
   }
   cout<<1<<" "<<2<<" "<<m+1;
  return 0;
}

signed main(){

   // sublime;
    raftaar;

    solve();

}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   ld n,x;
   cin>>n>>x;
   if(n==3){
    cout<<1<<" "<<2<<" "<<3;
    return 0;
   }
   if(n==4 || n==5){
    ld a=(ld)((n-2)*180)/n;
   ld b=(180-a)/2;
   ld c=(3*a-180)/2;
   a=abs(a-x);
   b=abs(b-x);
   c=abs(c-x);
   if(a<=b && a<=c){
    cout<<1<<" "<<2<<" "<<3;
   }
   else if(b<=a && b<=c){
    cout<<2<<" "<<1<<" "<<3;
   }
   else{
    cout<<3<<" "<<1<<" "<<4;
   }
  return 0;
   }
   ld mn=abs(((180*(n-2))/n)-x);
   int m=2;
   rep(i,3,n-2){
    ld y=(180*(n-i))/n;
    if(abs(y-x)<mn){
      m=i;
      mn=abs(y-x);
    }
   }
   cout<<1<<" "<<2<<" "<<m+1;
  return 0;
}

signed main(){

    //sublime;
    raftaar;

    solve();

}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   ld n,x;
   cin>>n>>x;
   if(n==3){
    cout<<1<<" "<<2<<" "<<3;
    return 0;
   }
   if(n==4 || n==5){
    ld a=(ld)((n-2)*180)/n;
   ld b=(180-a)/2;
   ld c=(3*a-180)/2;
   cout<<a<<" "<<b<<" "<<c<<"\n";
   a=abs(a-x);
   b=abs(b-x);
   c=abs(c-x);
   if(a<=b && a<=c){
    cout<<1<<" "<<2<<" "<<3;
   }
   else if(b<=a && b<=c){
    cout<<2<<" "<<1<<" "<<3;
   }
   else{
    cout<<3<<" "<<1<<" "<<n;
   }
  return 0;
   }
   ld mn=abs(((180*(n-2))/n)-x);
   int m=2;
   rep(i,3,n-2){
    ld y=(180*(n-i))/n;
    if(abs(y-x)<mn){
      m=i;
      mn=abs(y-x);
    }
   }
   cout<<1<<" "<<2<<" "<<m+1;
  return 0;
}

signed main(){

   // sublime;
    raftaar;

    solve();

}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   ld n,x;
   cin>>n>>x;
   if(n==3){
    cout<<1<<" "<<2<<" "<<3;
    return 0;
   }
   if(n==4 || n==5){
    ld a=(ld)((n-2)*180)/n;
   ld b=(180-a)/2;
   ld c=(3*a-180)/2;
   //cout<<a<<" "<<b<<" "<<c<<"\n";
   a=abs(a-x);
   b=abs(b-x);
   c=abs(c-x);
   if(a<=b && a<=c){
    cout<<1<<" "<<2<<" "<<3;
   }
   else if(b<=a && b<=c){
    cout<<2<<" "<<1<<" "<<3;
   }
   else{
    cout<<3<<" "<<1<<" "<<n;
   }
  return 0;
   }
   ld mn=abs(((180*(n-2))/n)-x);
   int m=2;
   rep(i,3,n-2){
    ld y=(180*(n-i))/n;
    if(abs(y-x)<mn){
      m=i;
      mn=abs(y-x);
    }
   }
   cout<<1<<" "<<2<<" "<<m+1;
  return 0;
}

signed main(){

    //sublime;
    raftaar;

    solve();

}


#include <bits/stdc++.h>
using namespace std;
#define raftaar ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define in freopen("input.txt","r",stdin);
#define out freopen("out.txt","w",stdout);
#define sublime in out
#define int int64_t
#define rep(i,a,b) for (int i = a; i <= b; ++i)
typedef long double ld;
typedef vector<int> vi;
#define F first
#define S second
#define PB push_back
#define LB lower_bound
#define mp make_pair
typedef pair<int,int> PII;
typedef vector<PII> VII;
#define all(c) (c).begin(),(c).end()
#define sz(a) ((int)(a).size())
bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;}
int power(int x,int y){int ans=1;while(y > 0){ if(y & 1){ans*=x;}y>>=1LL; x*=x;}return ans;}
int mod=1000000007;
int x[100005]={0};
inline int solve(){

   int n,x;
   cin>>n>>x;
   if(n==3){
    cout<<1<<" "<<2<<" "<<3;
    return 0;
   }

   ld a=(ld)((n-2)*180)/n;
   ld b=(180-a)/2;
   ld c=(3*a-180)/2;
   a=abs(a-x);
   b=abs(b-x);
   c=abs(c-x);
   if(a<=b && a<=c){
    cout<<1<<" "<<2<<" "<<3;
   }
   else if(b<=a && b<=c){
    cout<<2<<" "<<1<<" "<<3;
   }
   else{
    cout<<3<<" "<<1<<" "<<4;
   }
  return 0;
}

signed main(){

    //sublime;
    raftaar;

    solve();

}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 998244353
#define ep 0.000000001
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    double n, a, dif, angle, mn=1000; cin>>n>>a;
    int ans=3, ver;
    for(int i=2;i<n;i++){
        angle=((n-i)*180)/n;
        dif=abs(angle-a);
        if(dif<=mn){
            mn=abs(angle-a);
            ver=ans;
        }
        ans++;
    }
    cout<<1<<" "<<2<<" "<<ver<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 998244353
#define ep 0.000000001
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, a, angle, ans, mn=INT_MAX, ver; cin>>n>>a;
    ans=3;
    for(int i=2;i<n;i++){
        angle=((n-i)*180)/n;
        if(abs(angle-a)<=mn){
            mn=abs(angle-a);
            ver=ans;
        }
        ans++;
    }
    cout<<1<<" "<<2<<" "<<ver<<endl;
    return 0;
}


//xuuef
#include <bits/stdc++.h>

using namespace std;

#define F 		first
#define S 		second
#define ll 		long long
#define ld 		long double
#define pii		pair<int, int>
#define vi 		vector<int>
#define mii 	map<int, int>
#define umii 	unordered_map<int, int>
#define pb		push_back
#define mk		make_pair
#define ask(x) 	cerr << fixed << #x << " = " << x << "\n";
#define INF 	1000000007
#define hell 	998244353

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

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

	ld n, a, c, res = INF;
	int x, k = 1;

	cin >> n >> a;

	c = 180 * (n - 2) / n;
	c = (180 - c) / 2;

	for (int i = n; i > 2; --i) {
		// cout << c << ' ';
		// cout << fabs(res - a) << ' ' << fabs(c - a) << '\n';
		if (fabs(res - a) > fabs(c - a)) {
			x = i;
			res = c;
		}
		c = c * ++k;
	}

	cout << "1 2 " << x;

	return 0;
}


//xuuef
#include <bits/stdc++.h>

using namespace std;

#define F 		first
#define S 		second
#define ll 		long long
#define ld 		long double
#define pii		pair<int, int>
#define vi 		vector<int>
#define mii 	map<int, int>
#define umii 	unordered_map<int, int>
#define pb		push_back
#define mk		make_pair
#define ask(x) 	cerr << #x << " = " << x << "\n";
#define INF 	1000000007
#define hell 	998244353

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

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

	int n, a, r;

	cin >> n >> a;

	r = n;
	for (int i = n; i >= 3; --i) {
		if (fabs((n - r + 1) * (180.0 / n) - a) > fabs((n - i + 1) * (180.0 / n) - a))
			r = i;
	}

	cout << "1 2 " << r;

	return 0;
}


//xuuef
#include <bits/stdc++.h>

using namespace std;

#define F 		first
#define S 		second
#define ll 		long long
#define ld 		long double
#define pii		pair<int, int>
#define vi 		vector<int>
#define mii 	map<int, int>
#define umii 	unordered_map<int, int>
#define pb		push_back
#define mk		make_pair
#define ask(x) 	cerr << #x << " = " << x << "\n";
#define INF 	1000000007
#define hell 	998244353

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

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

	ld n, a, c, res = INF;
	int x;

	cin >> n >> a;

	c = 180 * (n - 2) / n;
	// ask(c);
	c = (180 - c) / 2;
	// ask((n - 2) * c);

	for (int i = n; i > 2; --i) {
		if (fabs(res - a) > fabs(c - a)) {
			x = i;
			res = c;
			c += c;
		}
		else
			break;
	}

	cout << "1 2 " << x;

	return 0;
}


//xuuef
#include <bits/stdc++.h>

using namespace std;

#define F 		first
#define S 		second
#define ll 		long long
#define ld 		long double
#define pii		pair<int, int>
#define vi 		vector<int>
#define mii 	map<int, int>
#define umii 	unordered_map<int, int>
#define pb		push_back
#define mk		make_pair
#define ask(x) 	cerr << fixed << #x << " = " << x << "\n";
#define INF 	1000000007
#define hell 	998244353

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

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

	int n, a, c, res = INF;
	int x, k = 1;

	cin >> n >> a;

	c = 180 * (n - 2) / n;
	c = (180 - c) / 2;

	for (int i = n; i > 2; --i) {
		// cout << c << ' ';
		// cout << fabs(res - a) << ' ' << fabs(c - a) << '\n';
		if (abs(res - a) > abs(c - a)) {
			x = i;
			res = c;
		}
		c = c * ++k;
	}

	cout << "1 2 " << x;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n, a;

int main(){
    ios_base :: sync_with_stdio(false);
    cin >> n >> a;
    if(n == 3){
        cout << "1 2 3";
        return 0;
    }
    long long ans = a * n / 180 + 2;
    cout << "2 1 " << min(n, max(3ll, ans));
}


#include <bits/stdc++.h>
using namespace std;
long long n, a;

int main(){
    ios_base :: sync_with_stdio(false);
    cin >> n >> a;
    if(n == 3){
        cout << "1 2 3";
        return 0;
    }
    long long ans = 2.50000000 + (double)a * n / 180;
    cout << "2 1 " << min(n, max(3ll, ans));
}


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

int main()
{
	int n, a; cin >> n >> a;
	int t=(n-2)*180;
	t/=n;
	int arr[n-1]={0};
	double div=(double)t/(double)(n-2);
	for(int i=1;i<n-1;++i)
	arr[i]=arr[i-1]+div;

	int vertex=0;
	int MIN=1e9+7;

	for(int i=1;i<n-1;++i){
		if(abs(arr[i]-a)<MIN){
			MIN=abs(arr[i]-a);
			vertex=i+2;
		}
	}

	cout << "2 1 " << vertex;
	return 0;
}


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

#define ldb long double
int main()
{
	int n;
	ldb a; cin >> n >> a;
	ldb t=(ldb)(n-2)*(ldb)180;
	t/=(ldb)n;
	ldb arr[n-1];
	arr[0]=0;
	ldb div=(ldb)t/(ldb)(n-2);
	for(int i=1;i<n-1;++i)
	arr[i]=arr[i-1]+div;

	int vertex=0;
	ldb MIN=1e9+7;

	for(int i=1;i<n-1;++i){
		if(abs(arr[i]-a)<MIN){
			MIN=abs(arr[i]-a);
			vertex=i+2;
		}
	}

	cout << "2 1 " << vertex;
	return 0;
}


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

#define testcases int t; cin>>t; while(t--)
#define int long long
const int MOD =  1e9 + 7;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int32_t main()
{

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

    FASTIO;

    double n, a;
    cin >> n >> a;

    double maxi = 360 / n;
    double diff = 1e9;

    int ans;

    for (double i = 1; i <= n - 2; i++)
    {
        double cur = maxi / i;
        double cur_diff = abs(cur - a);

        if (cur_diff <= diff)
        {
            ans = i + 2;
            diff = cur_diff;
        }

    }

    cout << 1 << " " << 2 << " " << ans;

}


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

#define testcases int t; cin>>t; while(t--)
#define int long long
const int MOD =  1e9 + 7;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int32_t main()
{

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

    FASTIO;

    double n, a;
    cin >> n >> a;

    double maxi = 360 / n;
    double diff = 1e9;

    int ans;

    for (double i = 1; i <= n - 2; i++)
    {
        double cur = maxi / i;
        double cur_diff = abs(cur - a);

        if (cur_diff <= diff)
        {
            ans = n - i + 1;
            diff = cur_diff;
        }

    }

    cout << 1 << " " << 2 << " " << ans;

}


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

#define testcases int t; cin>>t; while(t--)
#define int long long
const int MOD =  1e9 + 7;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int32_t main()
{

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

    FASTIO;

    double n, a;
    cin >> n >> a;
    double del = 1e9;

    int result = 0;
    for (int i = 1; i <= n - 2; i++) {
        double ang = double(i) * 180 / n;
        if (abs(ang - a) < del) {
            del = abs(ang - a);
            result = i;
        }
    }
    cout << 1 << ' ' << 2 << ' ' << n - result + 1 << '\n';

}


#include<stdio.h>
#include<math.h>
int main(){
	int n,a;
	scanf("%d %d",&n,&a);
	if(n==3){
		printf("1 2 3\n");
	}else{
		double du=180.0/n;//��С�ڽǶ���
		double ans=0x3f3f3f3f;
		int i;
		for(int j=1;j<=n-2;j++){
			if(ans>fabs(a-1.0*j*du)){//����ֵ�����Сֵ
				ans=a-j*du;
				i=j; // ��¼��Сֵλ��
			}
		}
		printf("2 1 %d\n",2+i);  //�� 2����ΪҪ����ǰ�������㲻Ȼ��ֱ����
	}
	return 0;
}

/*
��˵��ƪ������д������ʧ����
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

typedef pair<LL,LL>PII;

set<int>s;
set<int>::iterator cp;

int main(){
    int n,a;
    scanf("%d%d",&n,&a);
    int ed = (n-2)*180;
    int st = 180;
    a *= n;
    int t1;

    for(int i=1;;i++)
    {
        int tp = st*i;
        if(tp <= ed && tp <= 360*n) s.insert(tp);
        else break;
    }

    cp = s.lower_bound(a);
    if(cp == s.end())
        t1 = ed;
    else
        t1 = *cp;

    if(cp != s.begin())
    {
        int t2 = t1 - st;
        if(abs(t1-a) > abs(t2-a))
            t1= t2;
        printf("add==%d\n",t1);
        printf("1 %d ",n);
        int add = t1/st;
        printf("%d\n",1+add);
    }
    else{
    	printf("add==%d\n",t1);
        printf("1 %d ",n);
        int add = t1/st;
        printf("%d\n",1+add);

    }
    return 0;
}

*/


#include<stdio.h>
#include<math.h>
int main(){
	int n,a;
	scanf("%d %d",&n,&a);
	if(n==3){
		printf("1 2 3\n");
	}else{
		double du=180.0/n;//��С�ڽǶ���
		double ans=0x3f3f3f3f;
		int i;
		for(int j=1;j<=n-2;j++){
			if(ans>fabs(a-1.0*j*du)){//����ֵ�����Сֵ
				ans=a-j*du;
				i=j; // ��¼��Сֵλ��
			}
		}
		printf("1 2 %d\n",2+i);  //�� 2����ΪҪ����ǰ�������㲻Ȼ��ֱ����
	}
	return 0;
}

/*
��˵��ƪ������д������ʧ����
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

typedef pair<LL,LL>PII;

set<int>s;
set<int>::iterator cp;

int main(){
    int n,a;
    scanf("%d%d",&n,&a);
    int ed = (n-2)*180;
    int st = 180;
    a *= n;
    int t1;

    for(int i=1;;i++)
    {
        int tp = st*i;
        if(tp <= ed && tp <= 360*n) s.insert(tp);
        else break;
    }

    cp = s.lower_bound(a);
    if(cp == s.end())
        t1 = ed;
    else
        t1 = *cp;

    if(cp != s.begin())
    {
        int t2 = t1 - st;
        if(abs(t1-a) > abs(t2-a))
            t1= t2;
        printf("add==%d\n",t1);
        printf("1 %d ",n);
        int add = t1/st;
        printf("%d\n",1+add);
    }
    else{
    	printf("add==%d\n",t1);
        printf("1 %d ",n);
        int add = t1/st;
        printf("%d\n",1+add);

    }
    return 0;
}

*/


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

#define ll long long

int main()
{
	double n,a;
	cin>>n>>a;

	double angle=180/n;
	double ans=180;
	double pos=0;
	for(ll i=3;i<=n;i++)
	{
		if(abs((i-2)*angle-a)<ans)
		{
			ans=abs((i-2)*angle-a);
			pos=i;
		}
	}

	cout<<2<<" "<<1<<" "<<pos<<endl;

}


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

#define ll long long

int main()
{
	double n,a;
	cin>>n>>a;

	double angle=180/n;
	double ans=180;
	double pos=0;
	for(ll i=3;i<=n;i++)
	{
		if(abs((i-2)*angle-a)<ans)
		{
			pos=i;
		}
	}

	cout<<2<<" "<<1<<" "<<pos<<endl;

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long
#define double long double

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>,
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

signed main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
  long int n,a;
  cin>>n>>a;

  long int internal = (n - 2) * 180;
  internal /= n;
  long int delta = 1;
  double ans = 1e10;

  for(long int i = 1; i <=  n - 2; i++){
    double angleSubtend = internal/i ;
    if(llabs(angleSubtend - a) < ans){
      ans = fabsl(angleSubtend - a);
      delta = i;
    }
  }

  cout<<n - 1<<" "<<n<<" "<<delta;
   return 0;

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long
#define double long double

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>,
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

signed main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
  long int n,a;
  cin>>n>>a;

  double internal = (n - 2) * 180;
  internal /= n;
  long int delta = 1;
  double ans = 1e10;

  for(double i = 1; i <=  n - 2; i++){
    double angleSubtend = internal/i ;
    if(fabsl(angleSubtend - a) < ans){
      ans = fabsl(angleSubtend - a);
      delta = i;
    }
  }

  cout<<n - 1<<" "<<n<<" "<<delta;
   return 0;

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long
#define double long double

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>,
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

signed main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
  long int n,a;
  cin>>n>>a;

  double internal = (n - 2) * 180;
  internal /= n;
  long int delta = 1;
  double ans = 1e10;

  for(double i = n - 2; i > 0; i--){
    double angleSubtend = internal / (n - 2);
    angleSubtend *= i;

    if(fabsl(angleSubtend - a) < ans){
      ans = fabsl(angleSubtend - a);
      delta = i;
    }
  }

  cout<<n<<" "<<n-1<<" "<<(long int)delta;
   return 0;

}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>,
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
  long int n,a;
  cin>>n>>a;

  long int internal = (n - 2) * 180;
  internal /= n;
  long int delta = 1, ans = 1e10;

  for(long int i = 1; i <=  n - 2; i++){
    long int angleSubtend = internal/i;
    if(llabs(angleSubtend - a) < ans){
      ans = llabs(angleSubtend - a);
      delta = i;
    }
  }

  cout<<n - 1<<" "<<n<<" "<<delta;
   return 0;

}


#include "bits/stdc++.h"

#define ll long long
#define ull unsigned long long
#define ld long double

#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >
#define pis pair < int, string >

#define vi vector < int >
#define vd vector < double >
#define vld vector < ld >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define vpi vector < pii >
#define vpll vector < pll >
#define vpis vector < pis >

#define pb push_back

#define pi acos(-1)

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;

int a[maxn], b[maxn], c[maxn];

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

    fast;

    double n, a;

    cin >> n >> a;

    vd angles;
    double tmp = (180.0 / n), cnt = tmp;

    for(int i = 0; i < n - 2; i++) angles.pb(cnt), cnt += tmp;

    cout << 2 << ' ' << 1 << ' ';

    if(a <= angles[0]){
        cout << 3 << endl;
        return 0;
    }

    if(a >= angles.back()){
        cout << n << endl;
        return 0;
    }

    for(int i = 1; i < angles.size(); i++){
        if(a >= angles[i - 1] && a <= angles[i]){
            double tmp1 = abs(a - angles[i - 1]), tmp2 = abs(angles[i] - a);

            if(tmp1 < tmp2) cout << 2 + i << endl;
            else cout << 2 + i + 1 << endl;

            return 0;
        }
    }

    return 0;
}


#include "bits/stdc++.h"

#define ll long long
#define ull unsigned long long
#define ld long double

#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >
#define pis pair < int, string >

#define vi vector < int >
#define vd vector < double >
#define vld vector < ld >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define vpi vector < pii >
#define vpll vector < pll >
#define vpis vector < pis >

#define pb push_back

#define pi acos(-1)

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;

int a[maxn], b[maxn], c[maxn];

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

    fast;

    double n, a;

    cin >> n >> a;

    vd angles;
    double tmp = (180.0 / n);

    for(int i = 0; i < n - 2; i++) angles.pb(tmp), tmp += tmp;

    cout << n << ' ' << 1 << ' ';

    if(a <= angles[0]){
        cout << n - 1 << endl;
        return 0;
    }

    if(a >= angles.back()){
        cout << 2 << endl;
        return 0;
    }

    for(int i = 1; i < angles.size(); i++){
        if(a >= angles[i - 1] && a <= angles[i]){
            double tmp1 = abs(a - angles[i - 1]), tmp2 = abs(angles[i] - a);

            if(tmp1 < tmp2) cout << n - i << endl;
            else cout << n - i - 1 << endl;

            return 0;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	int n,a;
	 	cin>>n>>a;
	 	ld each=((2*n-4)*90)/(2*n);
	 	int cur=n;
	 	int ans;
	 	ld mini=ld(INT_MAX);
	 	ld start=each*2;
	 	while(cur>2)
	 	{
	 		if(abs(start-a)<mini)
	 		{
	 			mini=abs(start-a);
	 			ans=cur;
	 		}
	 		cur--;
	 		start-=each;
	 	}
	 	cout<<ans<<" 1 2";
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	ld n,a;
	 	cin>>n>>a;
	 	ld cur=3;
		ld start;
	 	ld mini=ld(LLONG_MAX),ans1;
	 	FOR(i,1,n-1)
	 	{
	 		cur=(180/n)*(i);
	 		if(abs(cur-a)<mini)
	 		{
	 			mini=abs(cur-a);
	 			ans1=i;
	 		}
	 	}
	 	cout<<n<<" "<<n-1<<" "<<ans1;
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	int n,a;
	 	cin>>n>>a;
	 	ld each=((2*n-4)*90)/(2*n);
	 	int cur=n;
	 	int ans;
	 	ld mini=ld(INT_MAX);
	 	ld start=each*2;
	 	while(cur>2)
	 	{
	 		if(abs(start-a)<mini)
	 		{
	 			mini=abs(start-a);
	 			ans=cur;
	 		}
	 		cur--;
	 		start-=each;
	 		each/=2;
	 	}
	 	cout<<ans<<" 1 2";
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	int n,a;
	 	cin>>n>>a;
	 	ld each=((2*n-4)*90)/n;
	 	int cur=3;
	 	int ans;
	 	ld mini=ld(INT_MAX);
	 	while(cur<=n)
	 	{
	 		if(abs(each*cur-a)<mini)
	 		{
	 			mini=abs(each-a);
	 			ans=cur;
	 		}
	 		cur++;
	 	}
	 	cout<<"2 "<<ans<<" 1";
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	ld n,a;
	 	cin>>n>>a;
	 	ld each=180-360/n;
	 	ll cur=3,ans;
		ld start;
	 	ld mini=ld(LLONG_MAX);
	 	while(cur<=n)
	 	{
	 		if(abs(each-a)<mini)
	 		{
	 			mini=abs(each-a);
	 			ans=cur;
	 		}
	 		// cout<<abs(a-each)<<ln;
	 		cur++;
	 		each/=2;
	 	}
	 	cout<<"1 2 "<<ans;
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	int n,a;
	 	cin>>n>>a;
	 	ld each=((2*n-4)*90)/(2*n);
	 	int cur=3;
	 	int ans;
	 	ld mini=ld(INT_MAX);
	 	while(cur<=n)
	 	{
	 		if(abs(each*(cur-2)-a)<mini)
	 		{
	 			mini=abs(each*(cur-2)-a);
	 			ans=cur;
	 		}
	 		// cout<<each*(cur-2)<<ln;
	 		cur++;
	 	}
	 	cout<<ans<<" 1 2";
		return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define debug1(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<"-->"<<y<<endl
#define debug3(x,y,z) cout<<x<<"-->"<<y<<"-->"<<z<<endl
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;
const int L=1e5+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	ld n,a;
	 	cin>>n>>a;
	 	ld each=180-360/n;
	 	ll cur=3,ans1,ans2;
		ld start;
	 	ld mini=ld(LLONG_MAX);
	 	FOR(i,2,n)
	 	{
	 		cur=180-(180/n)*(i);
	 		if(abs(cur-a)<mini)
	 		{
	 			mini=abs(cur-a);
	 			ans1=i,ans2=i+1;
	 		}
	 	}
	 	FOR(i,3,n+1)
	 	{
	 		cur=(180/n)*(i-1);
	 		if(abs(cur-a)<mini)
	 		{
	 			mini=abs(cur-a);
	 			ans1=i,ans2=i-1;
	 		}
	 	}
	 	cout<<"1 "<<ans1<<" "<<ans2;
		return 0;
}


#include <bits/stdc++.h>
#include <bits/extc++.h>
#define oo INT_MAX
#define ll long long
#define db double
#define mp(a, b) make_pair(a, b)
#define all(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rev(i, a, b) for (int i = (a); i >= (b); --i)
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define lowbit(x) x &(-x)
#define pi acos(-1.0)
using namespace std;
using namespace __gnu_pbds;
const int maxn = 189;
// FILE *o = freopen("C:\\Users\\Jason.Z\\Desktop\\in.txt", "r", stdin);
// assert(o != NULL);
// FILE *e = freopen("C:\\Users\\Jason.Z\\Desktop\\out.txt", "w", stdout);
// assert(e != NULL);
int n;
int main()
{
    int n, angle;
    cin >> n >> angle;
    int ans = 0;
    db m = oo;
    _rep(i, 1, n){
        if(fabs(i * (180 * 1.0 / n) - angle) < m){
            m = fabs(i * (180 * 1.0 / n) - angle);
            ans = i;
        }
    }
    ans += 2;
    if(ans > n)ans = n;
    printf("%d 1 2\n", ans);
}


#include <bits/stdc++.h>
#include <bits/extc++.h>
#define oo INT_MAX
#define ll long long
#define db double
#define mp(a, b) make_pair(a, b)
#define all(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rev(i, a, b) for (int i = (a); i >= (b); --i)
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define lowbit(x) x &(-x)
#define pi acos(-1.0)
using namespace std;
using namespace __gnu_pbds;
const int maxn = 189;
// FILE *o = freopen("C:\\Users\\Jason.Z\\Desktop\\in.txt", "r", stdin);
// assert(o != NULL);
// FILE *e = freopen("C:\\Users\\Jason.Z\\Desktop\\out.txt", "w", stdout);
// assert(e != NULL);
int n;
int main()
{
    int n, angle;
    cin >> n >> angle;
    int ans = 0;
    db m = oo;
    _rep(i, 1, n){
        if(fabs(i * (180 * 1.0 / n) - angle) < m){
            m = fabs(i * (180 * 1.0 / n) - angle);
            ans = i;
        }
    }
    ans += 2;
    printf("%d 1 2\n", ans);
}


#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
#define MOD 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define INF 1000000005
typedef long long ll;
typedef long double ld;
const int MAX = 2e5 + 5;
const int MAXN = 105;
int main() {
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for printing output from output.txt
    freopen("output1.txt", "w", stdout);
#endif
    // int t;
    // cin>>t;
    // while(\t--){
    int n, k;
    cin >> n >> k;
    ll a = 180 * (n - 2) / n;
    ll b = abs((180 - a) / 2);
    cout << b << " " << a << endl;
    if (abs(a - k) < abs(b - k)) cout << "1 2 3";
    else cout << "2 3 1";
    // }

}


#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
#define MOD 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define INF 1000000005
typedef long long ll;
typedef long double ld;
const int MAX = 2e5 + 5;
const int MAXN = 105;
int main() {
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for printing output from output.txt
    freopen("output1.txt", "w", stdout);
#endif
    // int t;
    // cin>>t;
    // while(\t--){
    int n, k;
    cin >> n >> k;
    ll a = 180 * (n - 2) / n;
    ll b = abs((180 - a) / 2);
    //cout << b << " " << a << endl;
    if (abs(a - k) < abs(b - k)) cout << "1 2 3";
    else cout << "2 3 1";
    // }

}


#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
#define MOD 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define INF 1000000005
typedef long long ll;
typedef long double ld;
const int MAX = 2e5 + 5;
const int MAXN = 105;
int main() {
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for printing output from output.txt
    freopen("output1.txt", "w", stdout);
#endif
    // int t;
    // cin>>t;
    // while(\t--){
    int n, k;
    cin >> n >> k;
    ld a = 180.0 * (n - 2) / n;
    ld b = fabs((180.0 - a) / 2.0);
    //cout << b << " " << a << endl;
    int x = 1, y = 2, z = 3;
    for (int i = 3; i <= n; i++) {
        ld cr = (i - 2) * b;
        if (fabs(cr - k) < a) {
            x = 2;
            y = 1;
            z = i;
            a = fabs(cr - k);
        }
    }
    cout << x << " " << y << " " << z << endl;
    // }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a[200001],s=0,f=0;
	cin>>n;
	std::map<long long, long long> map;
	for (long long i = 0; i < n; ++i)
	{
		cin>>a[i];
		map[a[i]]++;
	}

	std::vector<long long> v;
	for (auto i = map.begin(); i != map.end(); ++i)
		v.push_back(i->first);
		for (long long i = 1; i < v.size()-1; ++i)
		{
			if (v[i]-v[i-1]==1)
				s++;
			else
				s+=2;
			if (v[i+1]-v[i]==1)
				s++,i++;
			else
				s++;

		}
		if (v.size()==1)
			s++;
		if (v.size()==2)
		{
			if (v[1]-v[0]==1)
				s++;
			else
				s+=2;
		}
		cout<<s<<" ";
	for (auto i = map.begin(); i!= map.end(); ++i)
	{
		if (map[i->first]>2)
			map[i->first-1]++,map[i->first+1]++;
		else if (map[i->first]==2)
		{
			if (map[i->first-1]==0)
				map[i->first-1]++;
			else
				map[i->first+1]++;
		}
	}
	cout<<map.size();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a[200001],s=0,f=0;
	cin>>n;
	std::map<long long, long long> map,map1;
	for (long long i = 0; i < n; ++i)
	{
		cin>>a[i];
		map[a[i]]++;
	}

	for (int i = 1; i <= n;)
	{
		f=map[i];
		if (f>0)
			s++,i+=3;
		else
			i++;
	}
//	for (auto i = map.begin(); i!= map.end(); ++i)
//		cout<<i->second<<" ";
		cout<<s<<" ";

	for (auto i = map.begin(); i!= map.end(); ++i)
	{
		if (map[i->first]>2)
			map[i->first-1]++,map[i->first+1]++;
	}
	f=0;
	/*for (auto i = map.begin(); i!= map.end(); ++i)
	{
		if (map[i->first]==2)
		{
			if (map[i->first-1]==0)
				map[i->first-1]++;
			else if (map[i->first+1]==0)
				map[i->first+1]++;
		}
	}*/
	s=0;
	for (int i = 1; i <= n+1; ++i)
	{
		if (map[i]==2)
			f++;
		else if (map[i]==0)
		{
			if (f>2)
				s+=2;
			else
				s+=f;
			f=0;
		}
	}

		f=0;
		for (int i = 1; i <= n; ++i)
		{
			if (map[i]>0)
				f++;
		}
	cout<<f+s;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a[200001],s=0,f=0;
	cin>>n;
	std::map<long long, long long> map;
	for (long long i = 0; i < n; ++i)
	{
		cin>>a[i];
		map[a[i]]++;
	}
	std::vector<long long> v;
	for (auto i = map.begin(); i != map.end(); ++i)
		v.push_back(i->first);
		for (long long i = 1; i < v.size()-1; ++i)
		{
			if (v[i]-v[i-1]==1)
				s++;
			else
				s+=2;
			if (v[i+1]-v[i]==1)
				s++,i++;
			else
				s++;

		}
		cout<<s<<" ";
	for (auto i = map.begin(); i!= map.end(); ++i)
	{
		if (map[i->first]>2)
			map[i->first-1]++,map[i->first+1]++;
		else if (map[i->first]==2)
		{
			if (map[i->first-1]==0)
				map[i->first-1]++;
			else
				map[i->first+1]++;
		}
	}
	cout<<map.size();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a[200001],s=0,f=0;
	cin>>n;
	std::map<long long, long long> map;
	for (long long i = 0; i < n; ++i)
	{
		cin>>a[i];
		map[a[i]]++;
	}
	std::vector<long long> v;
	for (auto i =map.begin(); i != map.end(); ++i)
		v.push_back(i->first);
	//v.push_back(10000000000);
	//v.push_back(20000000000);
	long long c=0,i;
	//std::map<int, int> map1;
	//cout<<
	long b=v.size()-2;
	for ( i = 0; i < b;)
	{
		//cout<<"e";
		if (v[i+1]-v[i]==1&&v[i+2]-v[i]==1)
		s++,i+=3;
		else if (v[i+1]-v[i]==1||v[i+2]-v[i+1]==1)
		s+=2,i+=2;
		else
			s+=3,i+=2;
	}
	if (i==v.size()-2&&v.size()>2)
	{
		if (v[i+1]-v[i]>1)
			s++;
	}
	if (v.size()==2)
	{
		if (v[1]-v[0]>1)
			s+=2;
		else
			s++;
	}
	if (v.size()==1)
		s++;
	cout<<s<<" ";
	for (auto i = map.begin(); i!= map.end(); ++i)
	{
		if (map[i->first]>2)
			map[i->first-1]++,map[i->first+1]++;
		else if (map[i->first]==2)
		{
			if (map[i->first-1]==0)
				map[i->first-1]++;
			else
				map[i->first+1]++;
		}
	}
	cout<<map.size();
}


#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 55, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n+1) {
        if (maxCnt[i] == 0 && maxCnt[i+1] > 1) {
            maxCnt[i+1]--;
            maxCnt[i]++;
        } else if (maxCnt[i] > 1) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

bool cnt[MAXN], maxCnt[MAXN];
int n;
vi x;

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int a; cin >> a;
        x.pb(a);
    }
    sort(x.begin(), x.end());

    ll minAns = 0;
    for (int a : x) {
        if (cnt[a] | cnt[a-1] | cnt[a+1] ) continue;
        minAns++;
        cnt[a+1] = true;
    }

    ll maxAns = 0;
    for (int a : x) {
        maxAns++;
        if (!maxCnt[a-1]) {
            maxCnt[a-1] = true;
            continue;
        }
        if (!maxCnt[a]) {
            maxCnt[a] = true;
            continue;
        }
        if (!maxCnt[a+1]) {
            maxCnt[a+1] = true;
            continue;
        }
        maxAns--;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n) {
        if (cnt[i] == 0 && maxCnt[i] == 0 && cnt[i+1] > 1) {
            maxCnt[i+1]--; cnt[i+1]--;
            maxCnt[i]++;
        } else if (cnt[i] > 1) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n) {
        if (cnt[i] == 0 && maxCnt[i] == 0 && cnt[i+1] > 1) {
            maxCnt[i+1]--; cnt[i+1]--;
            maxCnt[i]++;
        } else if (cnt[i] > 1 || (cnt[i] == 1 && maxCnt[i] > cnt[i])) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n+1) {
        if (maxCnt[i] == 0 && maxCnt[i+1] > 1) {
            maxCnt[i+1]--;
            maxCnt[i]++;
        } else if (maxCnt[i] > 1) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n+1) {
        if (cnt[i] == 0 && maxCnt[i] == 0 && cnt[i+1] > 1) {
            maxCnt[i+1]--; cnt[i+1]--;
            maxCnt[i]++;
        } else if (cnt[i] > 1) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n) {
        if (cnt[i] == 0 && maxCnt[i] == 0 && cnt[i+1] > 1) {
            maxCnt[i+1]--; cnt[i+1]--;
            maxCnt[i]++;
        } else if (cnt[i] > 1 || (cnt[i] == 1 && maxCnt[i] > 0)) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


/*#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
vi x;
int cnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    FOR(i, 1, n) {
        int a; cin >> a;
        cnt[a]++;
        x.pb(a);
    }

    int minAns = 0;
    FOR(i, 1, n) {
        if (cnt[i] > 0) {
            minAns++;
            i += 2;
        }
    }
    cout << minAns << " ";

    int maxAns = 0;
    FOR(i, 0, n+1) {

    }

    return 0;
}*/

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

int n;
int cnt[MAXN];
int minCnt[MAXN], maxCnt[MAXN];

int main()
{
    FAST_IO;
    //ifstream in ("pump.in");
    //ofstream out ("pump.out");

    cin >> n;
    REP(n) {
        int x; cin >> x;
        cnt[x]++;
    }

    int lastPos = -100;
    FOR(i, 1, n) {
        if (cnt[i] == 0) continue;
        //if (i == lastPos) minCnt[i] += cnt[i];
        //else if (i == lastPos+1) minCnt[i-1] += cnt[i];
        if (i > lastPos+1) {
            lastPos = i+1;
            //minCnt[lastPos] += cnt[i];
        }
        minCnt[lastPos] += cnt[i];
    }

    FOR(i, 1, n) maxCnt[i] = cnt[i];
    FOR(i, 0, n+1) {
        if (cnt[i] == 0 && cnt[i+1] > 1) {
            maxCnt[i+1]--; cnt[i+1]--;
            maxCnt[i]++;
        } else if (cnt[i] > 1) maxCnt[i+1]++;
    }

    int minAns = 0, maxAns = 0;
    FOR(i, 0, n+1) {
        if (minCnt[i] > 0) minAns++;
        if (maxCnt[i] > 0) maxAns++;
    }

    cout << minAns << " " << maxAns;

    return 0;
}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

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

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

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

    lli min=0;

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

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

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

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

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

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

    lli min=0;

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

    lli i=1;
    while(i<=n)
    {
    // 	cout<<i<<" ";

    	if(b[i]>0)
    	{
    		min++;
    		i+=3;
    	}

    	else
    		i++;
    }

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

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

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

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

    lli min=0;

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

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

    // cout<<"\n";

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

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

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

    		else
    		{
    			c[i]-=1;
    			c[i+1]++;

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

    	}
    }

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

    lli min=0;

    for(lli i=2;i<=n+3;i+=3)
    {
    	if(b[i]||b[i+1]||b[i-1])
    		min++;
    }

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

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

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

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

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

    lli min=0;

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

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

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

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

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

    lli min=0;

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

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}


//Jatin Kumar
//jatiny17

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

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

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

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

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

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

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

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

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

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

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

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

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

    return r;
}

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

    a=a%m;

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

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

    return r;
}

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

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

int main()
{
    fast;

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

    lli n;
    cin>>n;

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

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

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

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

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

    lli min=0;

    for(lli i=2;i<=n;i+=3)
    {
    	if(b[i]||b[i+1]||b[i-1])
    		min++;
    }

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

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

    // cout<<"\n";

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

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

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

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

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

    lli max=0;

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

    // cout<<"\n";

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

    print2(min,max);

}