Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw $$$n$$$ squares in the snow with a side length of $$$1$$$. For simplicity, we assume that Sofia lives on a plane and can draw only segments of length $$$1$$$, parallel to the coordinate axes, with vertices at integer points.In order to draw a segment, Sofia proceeds as follows. If she wants to draw a vertical segment with the coordinates of the ends $$$(x, y)$$$ and $$$(x, y+1)$$$. Then Sofia looks if there is already a drawn segment with the coordinates of the ends $$$(x', y)$$$ and $$$(x', y+1)$$$ for some $$$x'$$$. If such a segment exists, then Sofia quickly draws a new segment, using the old one as a guideline. If there is no such segment, then Sofia has to take a ruler and measure a new segment for a long time. Same thing happens when Sofia wants to draw a horizontal segment, but only now she checks for the existence of a segment with the same coordinates $$$x$$$, $$$x+1$$$ and the differing coordinate $$$y$$$.For example, if Sofia needs to draw one square, she will have to draw two segments using a ruler:   After that, she can draw the remaining two segments, using the first two as a guide:   If Sofia needs to draw two squares, she will have to draw three segments using a ruler:   After that, she can draw the remaining four segments, using the first three as a guide:   Sofia is in a hurry, so she wants to minimize the number of segments that she will have to draw with a ruler without a guide. Help her find this minimum number.

The only line of input contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$), the number of squares that Sofia wants to draw.

Print single integer, the minimum number of segments that Sofia will have to draw with a ruler without a guide in order to draw $$$n$$$ squares in the manner described above.

#include<stdio.h>
#include<math.h>
#define ll long long int
  int main(){
    int n;
    scanf("%d",&n);
     double x=sqrt(n);
     int b=ceil(x),a=floor(x);
     if(a==b)
      printf("%d\n",2*a);
     else if((n-a*a-a)<=0)
      printf("%d\n",2*a+1);
     else
      printf("%d\n",2*a+2);

    return 0;
  }

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,sub,pro;
    scanf("%d",&pro);
    a = 1;
    b = 1;
    while(a*b<pro)
    {
        a++;
        if(a*b>=pro)
            break;
        b++;
    }
    sub = a + b;
    printf("%d\n",sub);
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d",&n);
    int i,segments=n+1;
    for(i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(segments>i+(n/i)) segments=i+(n/i);
        }
        else
        {
            if(segments>i+(n/i)+1) segments=i+(n/i)+1;
        }
    }
    printf("%d",segments);
    return 0;
}

#include <stdio.h>
#include <math.h>

int main(void)
{
	int n, x, y;

	scanf ("%d", &n);

	int root = (int)sqrt(n);
	x=y=root;
	int tm;

	tm = x*y;
	if (tm < n) ++y, tm += x;
	if (tm < n) ++x;

	printf ("%d\n", x+y);

	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	double n,x,ans;
	scanf("%lf",&n);
        x=sqrt(n);
	ans=ceil(2*x);
	printf("%d\n",(int)ans);

	return 0;
}

#include <math.h>
#include <stdio.h>

int main()
{
    int n;
    scanf("%d",&n);
    int s = sqrt((double)n);
    if(n%s==0){
        printf("%d",(int)(s+n/s));
    }
    else{
         printf("%d",(int)(s+n/s+1));
    }
}

#include<stdio.h>
#include<math.h>

int main()
{
	int w,h, u1, u2, d1, d2;
	scanf("%d",&w);
	int r = (int) sqrtl(w+1e-7);
	if(r*r == w){
		printf("%d",2*r);
	}
	else{
		//r += r;
		u1 = (r+1)*(r+1) - w;
		u2 = w - r*r;
		//printf("%d %d ", u1, u2);
		if(u1>u2){
			printf("%d", r+r+1);
		}
		else printf("%d", r+r+2);
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int judge(int x) {
	if(sqrt(x)==(int)sqrt(x))return 1;
	return 0;
}
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		if(n==1) {
			printf("2\n");
			continue;
		}
		int x=1,y=1;
		while(x*y<n){
			if(x>y)y++;
			else x++;
		}
		printf("%d\n",x+y);
	}
	return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
	int n;
	int ans = 1000000007;
	int buf;

	scanf("%d", &n);

	for (int i = 1; i <= sqrt(n); i++)
	{
		buf = n / i;

		if (n % i != 0)
			buf++;

		if (ans > i + buf)
			ans = i + buf;
	}

	printf("%d", ans);

	return 0;
}

#include <stdio.h>
#include <math.h>
int main()
{
	int mix, n, sq, el, another1, another2;
	mix=0;
	scanf("%d", &n);
	sq=sqrt(n);
	el=n-sq*sq;
	another1=el/sq;
	another2=el%sq;
	if(another2!=0)
	{
		mix++;
	}
	mix=mix+2*sq+another1;
	printf("%d\n", mix);

	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int n,y;
	double l,u,d,x;
	scanf("%d",&n);
	double a=sqrt((double)n);
	l=floor(a);
	if(l!=a)
	{
	u=ceil(a);
    d=n-(l*l);
    if(d>l)
    x=2*u;
    else
    x=2*l+1;
    y=(int)x;
}
else
y=2*a;
printf("%d",y);
    return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

 int main()
 {
 	double n,p,q;
 	scanf("%lf",&n);
 	if(n==1){
 		printf("2");
 	}
 	else if(n==2){
 		printf("3");
 	}
 	else if(n==3){
 		printf("4");
 	}
 	else if(n==4){
 		printf("4");
 	}
 	else{
 		p=sqrt(n);
 		p=ceil(p);
 		q=(p*p);
 		if((q-n)<p){
 			printf("%d",(int)(p*2));
 		}
 		else{
 			printf("%d",(int)((p*2)-1));
 		}
 	}

 	//cout << "Hello, Dcoder!";
 }

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char const *argv[])
{
	unsigned long long int n,n1;
	scanf("%I64d",&n);
	n1 = sqrt(n);
	if (n == 1)
	{
		printf("2");
	}
	else if (n == 2)
	{
		printf("3");
	}
	else if (n == 3)
	{
		printf("4");
	}
	else
	{
	if (n == n1 * n1)
	{
		printf("%I64d",2*n1);
		return 0;
	}
	else
	{
	    n1++;
		if(n <= n1* (n1-1))
		{
			printf("%I64d",2*n1 -1);
		}
		else
		{
			printf("%I64d",2*n1);
		}
	}
	}
	return 0;
}

#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
 int n ;
    scanf("%d",&n);
    int r = sqrt(n);
    if (r*r==n)printf("%d",r*2);
    else if(n>r*r && n<=r*(r+1))printf("%d",2*r+1);
    else if(n>r*(r+1) && n<=(r+1)*(r+1))printf("%d",2*(r+1));
    return 0;}

#include<stdio.h>
#include<math.h>
int main(void)
{
long long int n;
scanf("%lld",&n);
long long int root=(int)pow(n,0.5);
long long int ans;
if(pow(root+1,2)-(root+1)>=n)
{
ans=2*root+1;
}
else
ans=2*root+2;
if(root*root==n)
ans=ans-1;
printf("%lld",ans);
return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int n,i=2,set=0,k=4;
	scanf("%d",&n);
	if(n<4)
	printf("%d",n+1);
	else if(n==4)
	printf("%d",n);
	else
	{
		while(pow(i+1,2)<=n)
		{
			i++;
		}
		set=2*i;
		if(n-i*i==0)
		printf("%d",set);
		else if(n-i*i>i)
		printf("%d",set+2);
		else if(n-i*i<=i)
		printf("%d",set+1);

//
//		if(n==5||n==6)
//		printf("5");
//        else if(n==9)
//         printf("6");
//		else
//		printf("%d",i+1);

}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
    int n;
    scanf("%d",&n);
    int root = (int)(ceil(sqrt(n)));
    int output;
    for(int i = 0; root*(root-i) >= n; i++){
        output = root+root-i;
    }
    printf("%d",output);
}

#include<stdio.h>

int main(){
int a,b,n;
a = b = 1;
scanf("%d\n",&n);
while(1){
    if(a*b >= n){
        printf("%d",a+b);break;
    }
    else if(a==b){
            b++;
        }
    else if(a<b){
        a++;
    }
    else{

    }
}
return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    long long int n,t=0;
    scanf("%lld",&n);
    t=sqrt((double)(n));
    if(t*t==n)
        printf("%lld",t+t);
    else
    {
        /*if(t>1){*/
        if((n-(t*t))%t==0)
            printf("%lld",t*2+(n-(t*t))/t);
            else
            printf("%lld",t*2+((n-(t*t))/t)+1);
    }
    /*else
    printf("%d",n+1);
    }*/
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
int main()
{
    int i,j;
    int n,t;
    int w,h;
    int a[110][3];
    scanf("%d",&w);
    for(i=1;i*i<=w;i++)
    {
        ;
    }
    i=i-1;
    printf("%d",i*2+(w-i*i+i-1)/i);
    return 0;
}

#include<stdio.h>
int main()
{
	long long n,s,i;
	long long a=1,b=1;

	scanf("%I64d",&n);

	for(i=0;;i++)
	{
		if(a*b>=n)
		{
			s=a+b;
			break;
		}

		if(a<b)
			a++;
		else
			b++;
	}

	printf("%I64d",s);

}

#include<stdio.h>
int main()
{
	int c = 1, k = 1, t = 1;
	int n;
	scanf("%d", &n);
	while(c * k < n)
	{
		if(t % 2 != 0)
		{
			c++;
		}
		else
		{
			k++;
		}
		t++;
	}
	printf("%d\n", c + k);
	return 0;
 }

#include<stdio.h>
#include<math.h>

int n;
int a, b;

int main()
{
    scanf("%d",&n);
    a=sqrt(n);
    b=n/a+(n%a!=0);
    printf("%d",a+b);
    return 0;
}

#include <stdio.h>

int main(void)
{
    int n,i,j,x,y;
    scanf("%d",&n);
    if(n==1)
        printf("2");
    else if(n==2)
        printf("3");
    else
    {
        x=y=2;
        while(x*y<n)
        {
            x++;
            if(x*y<n)
                y++;
        }
        printf("%d",x+y);
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
    int a;
    scanf("%d",&a);

    int n=(int)sqrt(a);

    if(n*n==a)
        printf("%d\n",2*n);
    else if(a<=n*n+n)
        printf("%d\n",2*n+1);
    else
        printf("%d\n",2*n+2);
}

#include <stdio.h>

int SEGMENTS(int k)
{
int total , p , required ;
p=2;
total = 1 ;
while(1)
{
total= total + p/2 ;
if (k<total)
{
    required = p ;
    break ;
}
p = p+1 ;
}
return required ;

}

int main()
{
int t;
scanf("%d", &t) ;
int m = SEGMENTS(t) ;
printf("%d",m);

}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,x,Rim;
    scanf("%d",&n);
    x=2*sqrt(n);
    if(x==sqrt(n)*2.00)
    {
        Rim=x;
    }
    else
    {
        Rim=x+1;
    }
    printf("%d\n",Rim);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main(){
int n,i,j,k,i1,i2;
scanf("%d",&n);
i1=0;
i2=n;
for(i=1;i<=n;i++){
    j=n/i;
    if(n%i!=0)
        j=j+1;
     if(abs(i-j)>abs(i1-i2))
        break;
     i1=i;
     i2=j;

}

printf("%d",i1+i2);
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef unsigned long long ll;
typedef long double LD;

#define MIN(a,b) ((a)<(b)?(a):(b))

int main(void)
{
    int N;
    int segments,minseg,minmul,mini,mul;
    int sqrtN;
    int i;

	#if 0
    FILE *fp;
	//fp = freopen("..\\..\\1047\\C\\1047C.TXT","r",stdin);
	fp = freopen("1047C.TXT","r",stdin);
	if (fp == NULL)
    {
        printf ("Cannot open file\n\n");
        exit(0);
    }
	#endif

    scanf("%d",&N);

    sqrtN = sqrt(N) + 1;

    minseg = 1000000000;

    for (i=1; i<=sqrtN; i++)
    {
        if (N%i == 0)
        {
            mul = N/i;
        }
        else
        {
            mul = N/i + 1;
        }

        segments = (i + mul);

        if (segments < minseg)
        {
            minseg = segments;
            minmul = mul;
            mini = i;
        }
    }

    //printf ("Minseg = %d, at %d*%d\n",minseg,minmul,mini);

    printf("%d",minseg);

}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,x1,y1,k,sum2,min,f,r,o,sum1,sum=0,y,count1,a[100000]={0};
scanf("%lld",&n);
count=1;
sum=1;
if(n==1){
    printf("2\n");
    return 0;
}
k=2;
while(1){
    count++;
    f=count*count;
    f-=count;
  //printf("%lld %lld %lld %lld\n",n,count*count,k,f);
    if(f>=n){
        printf("%lld",k+1);
        return 0;
    }

    if(count*count>=n){
        k+=2;
        printf("%lld",k);
        return 0;
    }

    k+=2;
}

return 0;
}

#include<stdio.h>
#include<math.h>
main()
{
	long int a, x, y;
	scanf("%ld", &a);
	x=sqrt(a);
	y=2*x;
	if (x*x!=a)
	y++;
	if (a>(x*(x+1)))
	y++;
	printf("%ld\n", y);
	return 0;
}

#include <stdio.h>

int max_ans[100000];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 2; i < 100000; i++) {
        max_ans[i] = i / 2 * (i - i / 2);
    }
    int ans = 2;
    while (n > max_ans[ans]) {
        ans++;
    }
    printf("%d", ans);
    return 0;
}

#include <math.h>
#include <stdio.h>

int main() {
	int n, a, m;

	scanf("%d", &n);
	a = sqrt(n);
	m = a * 2;
	if (a * a >= n)
		m += 0;
	else if (a * (a + 1) >= n)
		m += 1;
	else
		m += 2;
	printf("%d\n", m);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	double a;
	int x, m;
	scanf("%lf", &a);
	int l = a;
	x = sqrt(a);
	int p = x;

	for (int i = x;; i++)
	{
		p = x * i;
		if (p >= l)
		{
			m = i + x;
			break;
		}
	}
	printf("%d",m);
}

#include <math.h>
#include <stdio.h>

int main() {
	int n, x;

	scanf("%d", &n);
	x = ceil(sqrt(n));
	printf("%d\n", x * (x - 1) >= n ? x + x - 1 : x + x);
	return 0;
}

#include<stdio.h>
int main()
{
    long long int n,ans,i,ara[100001];
    scanf("%lld",&n);
    ara[2]=2;
    for(i=3;i<=100000;i++)
    {
       ara[i]=ara[i-1]+i/2;
    }
    for(i=0;; i++)
    {
        if(n==ara[i])
        {
            printf("%lld\n",i+1);
            break;
        }
        else if(n<ara[i])
        {
            printf("%lld\n",i);
            break;
        }
    }
    return 0;
}

#include <stdio.h>

int main(void) {
    int x, z, i, j;
    scanf("%d", &x);
    z = 2 * x;
    for (i = 1; i * i <= x; ++i) {
        if (x % i == 0) {
            j = x / i;
        }
        else {
            j = x / i + 1;
        }
        if (i + j < z) {
            z = i + j;
        }
    }

    printf("%d", z);
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	long long int s, n, x, y;

	scanf("%lld", &n);

	s=sqrt(n);

	if(s*s == n)
	{
		printf("%lld", (2*s));
	}
	else
	{
		x=(s*s)+s;

		if(n<=x){
			printf("%lld", (s*2)+1);
		}
		else{
			printf("%lld", (s*2)+2);
		}
	}
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int n;
	scanf("%d",&n);
	int i;
	i=sqrt(n);
	if(i*i==n)
		printf("%d\n",2*i);
	else{
		for(int j=i;j<i+3;j++){
			if(i*j>=n){
				printf("%d\n",i+j);
				break;
			}
		}
	}
}

#include <stdio.h>
#include <math.h>

int main()
{
    //Prompting for input
    int squares;
    scanf("%i", &squares);

    //Calculating largest square root
    int root = floor(sqrt(squares));

    if (squares == root * root)
        printf("%i", root * 2);
    else if (squares <= (root * root) + root)
        printf("%i", root * 2 + 1);
    else
        printf("%i", root * 2 + 2);

    return 0;
}

#include <stdio.h>
#include <math.h>
int solve(int n)
{
    int res;
    int tmp = sqrt((double)n);
    if(tmp*tmp==n)
        res = 2*tmp;
    else if(tmp*(tmp+1)>=n)
        res = 2*tmp+1;
    else
        res = 2*tmp+2;
    return res;
}
int main()
{
    int n;
    scanf("%d",&n);
    printf("%d\n",solve(n));
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef long long ll;
ll MAX = -100000000000;/*1e11*/
ll MIN =  100000000000;
ll MOD =  1000000007 ;
ll longlongoverflow = __LONG_LONG_MAX__ ;

ll maxormin2(ll a,ll b,int flag)
{
    if(flag==1)return a>b?a:b;
    else return a<b?a:b;
}

ll overflowcheck(ll a)
{
    if(a==1)
    return 0;
    else
    {
        ll temp = a;
        ll power = 1;
        while(longlongoverflow/temp>a)
        {
            temp *= a;
            power++;
        }
    return power+1;
    }
}

ll compare(const void *p,const void*q)
{
    return (*(ll*)p-*(ll*)q);
}

ll merge(ll A[],ll B[],ll l,ll m,ll r)
{
    ll count = 0;
    ll n1 = m-l+1;
    ll n2 = r-m;
    ll LA[n1],LB[n2],RA[n1],RB[n2] ;
    for(ll i=0;i<n1;i++){LA[i] = A[i+l]; LB[i] = B[i+l];}
    for(ll i=0;i<n2;i++){RA[i] = A[i+m+1]; RB[i] = B[i+m+1];}

    ll i=0,j=0,k=l;
    while(i<n1&&j<n2)
    {
        if(LA[i]<=RA[j])
        {
            A[k] = LA[i];
            B[k] = LB[i];
            i++;
        }
        else
        {
            count += n1-i;
            A[k] = RA[j];
            B[k] = RB[j];
            j++;
        }
        k++;
    }
    while(i<n1)
    {
        A[k] = LA[i];
        B[k] = LB[i];
        i++;
        k++;
    }
    while(j<n2)
    {
        A[k] = RA[j];
        B[k] = RB[j];
        j++;
        k++;
    }
    return count ;
}

ll mergesort(ll A[],ll B[],ll l,ll r)
{
    ll total = 0;
    if(l<r)
    {
        ll m = (r+l)/2;
        total += mergesort(A,B,l,m);
        total += mergesort(A,B,m+1,r);
        total += merge(A,B,l,m,r);
    }
    return total ;
}

int main(ll argc, char const *argv[])
{
    ll T = 1;

    for(ll t = 0; t < T; t++)
    {
         ll N;
    scanf("%lld",&N);
    int flag = 0;
    ll root ;
   for(ll e=1;e<=100000;e++)
   {
       if(N%e==0)
       {
           ll prod = N/e;
           if(prod==e)
           {
               flag = 1;
               root = prod;
           }
       }
   }
   if(flag==0)
   {
       root =  sqrt((N));
    //   printf("%lld\n",root);
       ll left = root*root ;
       ll right = root ;
        if(N<=(left+root))
        printf("%lld\n",2*root+1);
        else
        {
        printf("%lld\n",2*(root+1));
        }

   }
   else
   {
       printf("%lld\n",2*root);
   }

    }

    return 0;
}

#include<stdio.h>
int main()
{ long long int n,m;
	scanf("%lld",&n);
	int i,j,p;
	m=1;
	while(1)
	{
		if(m*m>=n)
		break;
	m++;
	}
	//Aprintf("m=%d",m);
	if(m*m==n)
	printf("%lld\n",2*m);
	else
	{
		p=n-(m-1)*(m-1);
		if(p<=m-1)
		printf("%lld",2*(m-1)+1);
		else
		printf("%lld",2*(m-1)+2);
	}

}

#include<stdio.h>
#include<math.h>
int main()
{
	long n;
	scanf("%ld",&n);
	double f;
	f=sqrt(n);
	long num;
	num=floor(f);
	long count;
	count=2*num;
	long diff;
	diff=n-pow(num,2);
	if(diff==0)
	{
		printf("%ld",count);
	}
	else if(diff<=num)
	{
		count++;
		printf("%ld",count);
	}
	else{
		count+=2;
		printf("%ld",count);
	}
}

#include<stdio.h>
#include<math.h>
int main()
{
    double x;
    unsigned int n,xx,y,re;
    scanf("%d",&n);
    if(n<1)     return 0;
    x=sqrt(n);
    xx=(long long int)x;
    y=n-xx*xx;
    re=xx*2;
    if(y>xx)    re+=2;
    if(y<=xx&&y>0)    re+=1;
    printf("%d\n",re);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main(void)
{
    int n;
    int d1, d2;
    scanf("%d", &n);
    if(n==1||n==2)
        printf("%d", n+1);
    else
    {
        for(int m=1; m<=n+1; m++)
        {
            if(m%2==0)
            {
                d1 = m/2;
                d2 = m/2;
                int max = d1*d2;
                if(n<=max)
                {
                    printf("%d", m);
                    break;
                }
            }
            else
            {
                d1=m/2;
                d2=m/2 + 1;
                int max = d1*d2;
                if(n<=max)
                {
                    printf("%d", m);
                    break;
                }
            }
        }
    }
}

#include<stdio.h>
#include<math.h>
int main()
{
	double n,x,ans;
	scanf("%lf",&n);
        x=sqrt(n);
	ans=ceil(2*x);
	printf("%d\n",(int)ans);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n;
    scanf("%d", &n);

    int a = floor(sqrt((double)n));
    int b = ceil((double)n / a);

    printf("%d\n", a + b);

    return 0;
}

#include <stdio.h>
int main()
{
	long long int n, cnt=3;
	scanf("%lld", &n);
	if(n==1)
	{
		printf("2\n");
	}
	else if(n==2)
	{
		printf("3\n");
	}

	else
	{
		int sum=2, f=0, q=2, temp=0;
		while(1)
		{

			if(sum>=n&&temp<n)
				break;

			temp=sum;
			sum+=q;
			if(f==1)
			{
			//	printf("1%d\n", sum);

				q++;
				f=0;
				cnt++;
				continue;
			}
			if(f==0)
			{
			//	printf("0%d\n", sum);

				f=1;
				cnt++;
			}

		}

		printf("%lld\n",cnt);
	}
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef float fl;
typedef char ch;
typedef long long ll;
#define rep(i,a,n) for(i=a;i<n;i++)
#define rev(i,n,a) for(i=n;i>=a;i--)
#define repr(i,a,b) for(i=a;i<b;i++)
#define s(n) scanf("%d",&n);
#define s2(n,m) scanf("%d%d",&n,&m);
#define s3(n,m,o) scanf("%d%d%d",&n,&m,&o);
#define p(n) printf("%d",n);
#define p2(n,m) printf("%d%d",n,m);
#define sc(n) scanf("%c",&n);
#define sf(n) scanf("%f",&n);
#define sl(n) scanf("%lld",&n);
#define pc(n) printf("%c",n);
#define pf(n) printf("%f",n);
#define pl(n) printf("%lld",n);
#define br break;
#define co continue;
int main()
{
	int n,i,x;
	scanf("%d",&n);

	for(i=2;  ;i++)
        {
		x=(i/2)*(i/2+(i%2));
		if(x>=n)
		{
			n = i;
			break ;
		}
        }
	printf("%d",n);
	return 0;
}

#include<stdio.h>
#define N 100000
long long array[N];
int main(void)
{
    long long i,ans,number;
    scanf("%lld",&number);
    for(i=1; i<N; i++)
        array[i]=i*i;
    for(i=N-1; i>=1; i--)
        if(number>=array[i])
            break;
    if(number==array[i])
        ans=2*i;
    else if(number-array[i]>i)
        ans=2*i+2;
    else
        ans=2*i+1;
    printf("%lld\n",ans);
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    int ans = 1 + n;
    for(int i = sqrt(n); i > 0; --i) {
        if(ans > i + n / i + (n / i * i != n)) {
            ans = i + n / i + (n / i * i != n);
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    double n, a;
    scanf("%lf", &n);
    a = sqrt(n);
    n = ceil(2*a);
    printf("%d\n", (int)n);
    return 0;
}

#include <stdio.h>
#include <math.h>

int main(){
  int n, i, j;
  scanf("%i", &n);
  i = sqrt(n);
  j = i*i;
  if(n>j+i) printf("%i", 2*i+2);
  else if(n>j && n<= j+i) printf("%i", 2*i+1);
  else printf("%i", 2*i);
}

#include<stdio.h>
int main(){
	long long int a;
	while(scanf("%lld",&a)!=EOF){
		long long int i=1,j=1;
		while(i*j<a){
			if(i<=j){
				i++;
			}
			else
				j++;
		}
		printf("%lld\n",i+j);
	}
}

#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	scanf("%d",&n);
	int s=sqrt(n);
	s=(int)s;
	int result=0;
	if (s*s==n)
	result=2*s;
	else if (n<=s*(s+1))
	result=2*s+1;
	else if (n>s*(s+1))
	result=2*(s+1);
	printf("%d\n",result);

}

#include<stdio.h>
int main()
{
	int n,r,x;
	scanf("%d",&n);
	r=sqrt(n);
	if(n%r!=0)
	x=n/r+1;
	else
	x=n/r;
	printf("%d",x+r);
}

#include <stdio.h>

int main(void)
{
 int n,seg,i,sq1=2,sq2=2;
 scanf("%d",&n);
 if(n<4)
  printf("%d",1+n);
 else if(n==4)
  printf("%d",n);
 else
 {
  for(i=sq1+sq2;(sq1*sq2)<n;i=sq1+sq2)
  {
   if(sq1==sq2)
    sq2++;
   else
    sq1++;
   /*printf("\nl %d r %d\n",sq1,sq2);*/
  }
  printf("%d",i);
 }
}

#include<stdio.h>
#include<math.h>
int main (void)
{ double n,x,y;
scanf("%lf",&n);
x=sqrt(n);
y=ceil(2*x);
printf("%d\n",(int )y);
return 0;}

#include<stdio.h>
#include<math.h>
int main ()
{
    int n;
    scanf("%d",&n);
    printf("%d\n",(int)ceil(sqrt(n)*2));
    return 0;
}

#include <stdio.h>

int main()
{
    int a;
    scanf("%d",&a);
    if(a==1)
    printf("2");
    else if(a==2)
    printf("3");
    else
    {
        int cnt=2;
        int k=0;
        int sum=4;
        int counter=0;
        for(int i=3;i<=a;i++)
        {
            counter++;
            if(counter==cnt)
            {
                if(k==0)
                {
                k=1;
                sum++;
                counter=0;
                }
                else
                {
                    k=0;
                    cnt++;
                    sum++;
                    counter=0;
                }

            }
        }
        if(counter!=0)
        printf("%d",sum);
        else
        printf("%d",sum-1);
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,sqr;
    scanf("%d",&n);
    sqr=sqrt(n);
    for(i=sqr;i<n;i++)
    {
        if(n<=i*sqr) break;
    }
    printf("%d",i+sqr);
    return 0;
}

#include <stdio.h>
#include <math.h>

int main() {
  int sof;
  scanf("%d", &sof);
  int sq = (int)sqrt(sof);
  if (sq*sq == sof)
    printf("%d\n", sq * 2);
  else if (sq * (sq + 1) >= sof)
    printf("%d\n", sq * 2 + 1);
  else
    printf("%d\n", sq * 2 + 2);
  return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,cnt;
    scanf("%d",&n);
    int x=sqrt(n);
    int rem=n-x*x;
    cnt=2*x;
    if(rem)
    {
        x=2*x+1;
        if(rem<=(x/2))
            cnt++;
        else
            cnt+=2;
    }
    printf("%d\n",cnt);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main ()
{
    unsigned long  n,c,k,l ;
    scanf("%d",&n);
    c=round(sqrt(n))*2;
    k=c+1;

     if(round(sqrt(n))>= sqrt(n))
    {
        printf("%d",c);
    }
    else if(round(sqrt(n))<sqrt(n))
    {
        printf("%d",k);
    }

}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main ()
{
    unsigned long  n,c,k,l ;
    scanf("%d",&n);
    c=round(sqrt(n))*2;
    k=c+1;
    if (round(sqrt(n))==sqrt(n))
    {
        printf("%d",c);
    }
    else if(round(sqrt(n))> sqrt(n))
    {
        printf("%d",c);
    }
    else if(round(sqrt(n))<sqrt(n))
    {
        printf("%d",k);
    }

}

#include<stdio.h>
#include<math.h>
int main()
{
    long long int x,y,n,ans,cnt=0,c=0;
    scanf("%lld",&n);
    ans=n+1;
    c=sqrt(n);
    y=c;
    while(c*y<n)
    {
       y++;
    }
    if(ans>(c+y))
        ans=c+y;
    printf("%lld\n",ans);

}

#include <stdio.h>
#include <math.h>
int main(){
    int N;
    scanf("%d",&N);
    int s = round(sqrt(N));
    if (s*s>=N){
        int ans = s+s;
        printf("%d\n",ans);
    }
    else if (s*(s+1)>=N){
        int ans = s+s+1;
        printf("%d\n",ans);
    }
    else{
        int ans = s+s+2;
        printf("%d\n",ans);
    }
    return 0;
}

#include <stdio.h>

#include <math.h>

int main( void )

{

    int i ;

    scanf("%d",&i) ;

    double d = i*1.0 ;

    double root = sqrt( d ) ;

    int ans = ceil(2*root) ;

    printf("%d\n",ans) ;

}

#include <stdio.h>
#include<string.h>
#include<math.h>

int main(){
    int n,x,lines;
    scanf("%d",&n);
    x=sqrt(n);
    lines=x*2;
    if((n-(x*x))>x){
        lines=lines+2;
    }
    else if((n-(x*x))==0){
        lines=lines;
    }
    else{
        lines=lines+1;
    }
    printf("%d",lines);
    return 0;
}

#include<stdio.h>
#include<math.h>
main(){
	long long int n;
	scanf("%lld",&n);
	long long int x,sq;
	sq=sqrt(n);
	x=ceil(sqrt(n)*2);
	printf("%lld",x);
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int x,i,j,s;
	while(scanf("%d",&x)!=EOF){
		for(i=1,j=1;;){
			s=i*j;
			if(s>=x){
				printf("%d\n",i+j);
				break;
			}
			else{
				if(i==j)i++;
				else j++;
			}
		}
	}
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
    int N;
    int n;
    scanf("%d", &N);
    n=sqrt(N);
    if(n*n == N)
        printf("%d\n", 2*n);
    else if(N <= n*n+n)
        printf("%d\n", 2*n+1);
    else
        printf("%d\n", 2*n+2);

}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    double sq;
    scanf("%d", &n);
    if(n < 3){
        printf("%d", n + 1);
        return 0;
    }
    sq = sqrt(n);
    sq *= 2;
    printf("%.0f", ceil(sq));
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    long int n,i;
    float k;
    scanf("%ld",&n);
    k=sqrt(n);
    i=k;
    if (n==i*i) printf("%ld",2*i);
    else if (n<=i*i+i) printf("%ld",2*i+1);
    else printf("%ld",2*i+2);
    return 0;
}

#include<stdio.h>
int main(void)
{
	unsigned long n,m,i,c;
	scanf("%lu",&n);
	for(i=1;i*i<n;i++){

	}
	if(i*(i-1)>=n)
	  {
		m=2*i-1;
      }
	else m=2*i;
	printf("%lu\n",m);
return 0;
}

#include <stdio.h>
#include <math.h>
int main(){
    long int n, i, a, b, c;
    scanf("%ld", &n);

    a = sqrt(n)/1;
    if(n > a*a && n <= a*(a+1)) printf("%ld", 2*a+1);
    if(n > a*(a+1)) printf("%ld", 2*a+2);
    if(n == a*a)printf("%ld", 2*a);
    return 0;
}

#include <stdio.h>
#include <math.h>

int main (){
	long long n, root, dif,cnt;
	scanf("%lld", &n);
	root = sqrt(n);
	dif = n-(root*root);
	if(dif==0) cnt = 2*root;
	else if(dif<=root) cnt = 2*root+1;
	else cnt = 2*root+2;
	printf("%lld\n" , cnt);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	double n,x,ans;
	scanf("%lf",&n);
        x=sqrt(n);
	ans=ceil(2*x);
	printf("%d\n",(int)ans);

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {

	int n;
	int i, j;
	int temp;
	int sum;

	scanf("%d", &n);

	if (n <= 3) {
		printf("%d", n + 1);
		return 0;
	}

	if (n == 4){
		printf("4");
	 return 0;
}

	else
	{
		for (i = 1; ; i++) {
			if (i*i > n) {
				temp = i - 1;
				break;
			}
			if (i*i == n){
				printf("%d", 4 + 2 * (i - 2));
			return 0;
		}

		}
		sum =temp*temp + temp;
		if (sum >= n)
		{
			printf("%d", 4 + 2*(temp-2)+1);
			return 0;
		}
		sum = temp * temp  + 2*temp+1;
		if (sum >= n) {
			printf("%d", 4 + 2 * (temp - 2) + 2);
			return 0;
		}
	}

		return 0;

}

#include <stdio.h>

int SEGMENTS(int s)
{
int Total , p , quired ;
p=2;
Total = 1 ;
while(1)
{
Total= Total + p/2 ;
if (s<Total)
{
    quired = p ;
    break ;
}
p = p+1 ;
}
return quired ;

}

int main()
{
int t;
scanf("%d", &t) ;
int m = SEGMENTS(t) ;
printf("%d",m);

}

#include<stdio.h>
typedef long long ll;
int main()
{
    ll n,cnt=0;
    scanf("%lld",&n);
    int f=0;
    for(ll nn=1;f==0;nn++)
    {
    ll a=nn*(nn-1);
    ll b=nn*(nn+1);
    if(n>a&&n<=b)
    {
    f=1;
    cnt=nn;
    break;
    }
    }
    ll sq=sqrt(n);
    if(sq*sq==n)
    {
    ll ans=2*sq;
    printf("%lld",ans);
    }
    else if(cnt==sq)
    {
    ll ans=cnt+cnt+1;
    printf("%lld",ans);
    }
    else
    {
    ll ans=cnt+cnt;
    printf("%lld",ans);
    }
    //printf("%lld %lld",cnt,sq);
    return 0;
}

#include<stdio.h>
#include<math.h>

int main()
{
    int n,x,r;

    scanf("%d",&n);

    x=sqrt(n)*2;

    if(x==sqrt(n)*2.00){
        r=x;
    }
    else{
        r=x+1;
    }
    printf("%d\n",r);

    return 0;
}

#include <stdio.h>
int get_int();

int max(int a, int b)
{
	if (a > b)
	{
		return a;
	}
	return b;
}

int min(int a, int b)
{
	if (a < b)
	{
		return a;
	}
	return b;
}

int main()
{
	int i, j;
	int n = get_int();
	i = 1;
	int r = 2000000000;
	while (i*i <= n)
	{
		j = (n + i - 1)/i;
		r = min(r, j + i);
		i++;
	}
	printf("%d\n", r);

	return 0;
}

int get_int()
{
	int ret = 0;
	char c  = getchar();
	int sgn;

	while (1)
	{
		if (c == EOF)
		{
			return EOF;
		}
		if (c >= '0' && c <= '9')
		{
			sgn = 1;
			break;
		}
		if (c == '-')
		{
			c = getchar();

			if (c < '0' || c > '9')
			{
				continue;
			}

			sgn = -1;
			break;
		}
		c = getchar();
	}

	while (1)
	{
		ret = (ret << 3) + (ret << 1) + c - '0';

		c = getchar();

		if (c < '0' || c > '9')
		{
			return sgn*ret;
		}
	}
}

#include <stdio.h>

int main(void) {
 long long int a=0,b=0,c=0,d=0,flag=1,e,sum,area;
  scanf("%I64d",&e);
  do
  {
    if(flag==1)
    {
      flag=2;
      a++;
    }
    else if(flag==2)
    {
      flag=3;
      b++;
    }
    else if(flag==3)
    {
      flag=4;
      c++;
    }
    else if(flag==4)
    {
      flag=1;
      d++;
    }
    sum=a+b+c+d;
    area=(a+c)*(b+d);
  }while(e>area);
  printf("%I64d\n",sum);
  return 0;
}

#include <stdio.h>
#include <conio.h>
#include <math.h>
int main(){
    int n,t1,t2;
    double sq;
    scanf("%d",&n);
    sq=sqrt((double)n);
    t2=(int)sq;
    if(sq==floor(sq)){
        printf("%d",2*t2);
    }
    else{
        t1=t2*(t2+1);
        if(n<=t1){
            printf("%d",(2*t2)+1);
        }
        else{
            printf("%d",2*(t2+1));
        }

    }
    return 0;

}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int x,n;
    scanf("%d",&n);
    x=(int)sqrt(n);
    if(n>x*x && n<=x*x+x)printf("%d",2*x+1);
    else if(n>x*x+x)printf("%d",2*x+2);
    else if(n=x*x)printf("%d",2*x);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int x;
    int n;
    scanf("%d",&n);
    x=(int)sqrt(n);
    if(n>x*x && n<=x*x+x)printf("%d",2*x+1);
    else if(n>x*x+x)printf("%d",2*x+2);
    else if(n=x*x)printf("%d",2*x);
    return 0;
}

#include<stdio.h>
#include <math.h>

int main(){
    int n;
    scanf("%d", &n);
    int t = (int)ceil(sqrt(n));
    if(n <= (t - 1) * t)
        printf("%d", 2 * t - 1);
    else
        printf("%d", 2 * t);
}

#include<stdio.h>

#define mod 998244353

int main(void) {
    int n;
    scanf("%d", &n);
    int d=4;
    if(n == 1) {
        printf("2");
    } else if (n == 2) {
        printf("3");
    } else if (n <= 4)  {
        printf("4");
    } else {
        int r = 2;
        int flag = 1;
        for(int i = 4; i< n; ) {
            d++;
            i += r;
            r += flag;
            flag = 1 - flag;
        }
        printf("%d", d);
    }

    return 0;
}

#include <stdio.h>

int main()
{
    int n,k=2,cnt=3,c=0,p,i;
    scanf("%d",&n);
    if(n==1)
    printf("2");
    else if(n==2)
    printf("3");
    else
    {
        for(i=3;i<=n;)
        {

           cnt++;
           c++;
           if(c==2)
           {
               i=i+k;
               k++;
           c=0;}
           else
           i=i+k;
        }
        printf("%d",cnt);
    }

    return 0;
}

#include <stdio.h>
int main(void)
{
	int n;
	scanf("%d",&n);
	int root=1;
	while(root*root<=n)
	{
		root++;
	}
	root--;
	if(root*root==n)
	{
		printf("%d\n",2*root);
	}
	else if(n<=root*root+root)
	{
		printf("%d\n", 2*root+1);
	}
	else
	{
		printf("%d\n", 2*root+2);

	}
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,sub,pro;
    scanf("%d",&pro);
    a = 1;
    b = 1;
    while(a*b<pro)
    {
        a++;
        if(a*b>pro)
            break;
        b++;
    }
    sub = a + b;
    printf("%d\n",sub);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,sub,pro;
    scanf("%d",&pro);
    a = 1;
    b = pro;
    sub = a+b;
    for(;a<=pro/2;a++)
    {
        if((pro%a==0)&&(pro/a+a<sub))
        {
            b = pro/a;
            sub = a+b;
        }
    }
    printf("%d\n",sub);
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d",&n);
    int i,segments=n+1;
    for(i=1;i*i<=n;i++)
    {
        if(n%i==0&&(i+(n/i))<segments)
        {
            segments=i+(n/i);
        }
    }
    printf("%d",segments);
    return 0;
}

#include<stdio.h>
#include<math.h>
int judge(int x) {
	if(sqrt(x)==(int)sqrt(x))return 1;
	return 0;
}
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		if(n==1) {
			printf("2\n");
			continue;
		}
		if(judge(n)) printf("%d\n",2*(int)sqrt(n));
		if(n&1)printf("%d\n",n+1);
		if(n%2==0) {
			int x=sqrt(n);//n=28   5 , 6
			int k=x+1;
			for (int i=x; i>=0; i--) {
				if(i*k++==n) {
					printf("%d\n",i+k-1);
					break;
				}
			}
		}
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int judge(int x) {
	if(sqrt(x)==(int)sqrt(x))return 1;
	return 0;
}
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		if(n==1) {
			printf("2\n");
			continue;
		}
		else if(judge(n)) printf("%d\n",2*(int)sqrt(n));
		else if(n&1)printf("%d\n",n+1);
		else if(n%2==0) {
			int x=sqrt(n);//n=28   5 , 6
			int k=x+1;
			for (int i=x; i>=0; i--) {
				if(i==2){
					printf("%d\n",2+n/2);
					break;
				}
				if(i*k++==n) {
					printf("%d\n",i+k-1);
					break;
				}
			}
		}
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int judge(int x) {
	if(sqrt(x)==(int)sqrt(x))return 1;
	return 0;
}
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		if(n==1) {
			printf("2\n");
			continue;
		}
		else if(judge(n)) printf("%d\n",2*(int)sqrt(n));
		else if(n&1)printf("%d\n",n+1);
		else if(n%2==0) {
			int x=sqrt(n);
			int k=x+1;
			for (int i=x; i>=0; i--) {
				if(i*k++==n) {
					printf("%d\n",i+k-1);
					break;
				}
			}
		}
	}
	return 0;
}

#include <stdio.h>

int main()
{
	int n;
	int ans = 1000000007;
	int buf;

	scanf("%d", &n);

	for (int i = 1; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			buf = i + n / i;
			ans = ans > buf ? buf : ans;
		}
	}

	printf("%d", ans);

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char const *argv[])
{
	unsigned long long int n,n1;
	scanf("%I64d",&n);
	n1 = sqrt(n);
	if (n == 1)
	{
		printf("2");
	}
	else if (n == 2)
	{
		printf("3");
	}
	else if (n == 3)
	{
		printf("4");
	}
	else
	{
	if (n == n1 * n1)
	{
		printf("%I64d",2*n1);
		return 0;
	}
	else
	{
		if(n <= n1* (n1-1))
		{
			printf("%I64d",2*n1 -1);
		}
		else
		{
			printf("%I64d",2*n1);
		}
	}
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char const *argv[])
{
	unsigned long long int n,n1;
	scanf("%I64d",&n);
	n1 = sqrt(n);
	n1++;
	if (n == 1)
	{
		printf("2");
	}
	else if (n == 2)
	{
		printf("3");
	}
	else if (n == 3)
	{
		printf("4");
	}
	else
	{
	if (n == n1 * n1)
	{
		printf("%I64d",2*n1);
		return 0;
	}
	else
	{
		if(n <= n1* (n1-1))
		{
			printf("%I64d",2*n1 -1);
		}
		else
		{
			printf("%I64d",2*n1);
		}
	}
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char const *argv[])
{
	unsigned long long int n,n1;
	scanf("%I64d",&n);
	n1 = sqrt(n);
	if (n == n1 * n1)
	{
		printf("%I64d",2*n1);
		return 0;
	}
	else
	{
		if(n <= n1* (n1-1))
		{
			printf("%I64d",2*n1 -1);
		}
		else
		{
			printf("%I64d",2*n1);
		}
	}
	return 0;
}

#include<stdio.h>
int main(void)
{
long long int n,ans;
scanf("%lld",&n);
if(n==1)
ans=2;
if(n==2)
ans=3;
if(n==3||n==4)
ans=4;
if(n>=5)
{
if(n%2==0)
n--;
ans=n-(n-5)/2;

}
printf("%lld\n",ans);

return 0;
}

#include<stdio.h>
#include<math.h>
int main(void)
{
long long int n;
scanf("%lld",&n);
long long int root=(int)pow(n,0.5);
long long int ans;
if(pow(root+1,2)-(root+1)>=n)
{
ans=2*root+1;
}
else
ans=2*root+2;
if(n==1)
ans=1;
if(n==4)
ans=4;
printf("%lld",ans);
return 0;
}

#include<stdio.h>
int main(void)
{
long long int n,ans;
scanf("%lld",&n);
if(n==1)
ans=2;
if(n==2)
ans=3;
if(n==3||n==4)
ans=4;
if(n>=5)
{
if(n%2==0)
n--;
ans=n+(n-5)/2;

}
printf("%lld\n",ans);

return 0;
}

#include<stdio.h>
#include<math.h>

int main(void)
{
long long int n,ans;
scanf("%lld",&n);
if((pow((int)pow(n,0.5)+1,2))-(int)pow(n,0.5)-1>n)
ans=2*(int)pow(n,0.5)+1;
else
ans=2*((int)pow(n,0.5)+1);

printf("%lld\n",ans);

return 0;
}

#include<stdio.h>
#include<math.h>

int main(void)
{
long long int n,ans;
scanf("%lld",&n);
if(n==1)
ans=2;
else if(n==2)
ans=3;
else
{
if((pow((int)pow(n,0.5)+1,2))-(int)pow(n,0.5)-1>n)
ans=2*(int)pow(n,0.5)+1;
else
ans=2*((int)pow(n,0.5)+1);

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

#include<stdio.h>
#include<math.h>
int main(void)
{
long long int n;
scanf("%lld",&n);
long long int root=(int)pow(n,0.5);
long long int ans;
if(pow(root+1,2)-(root+1)>=n)
{
ans=2*root+1;
}
else
ans=2*root+2;
if(n==1)
ans=2;
if(n==4)
ans=4;
printf("%lld",ans);
return 0;
}

#include<stdio.h>
int main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	if(n<4)
	printf("%d",n+1);
	else if(n==4)
	printf("%d",n);
	else
	{
		for(i=2;sum<=n;i++)
		{
			sum=sum+i;

		}
		if(n==5||n==6)
		printf("5");
        else if(n==9)
         printf("6");
		else
		printf("%d",i+1);

}
	return 0;
}

#include<stdio.h>
#include<math.h>
main()
{
 int n,a,c;
 float b;
 scanf("%d",&n);
 b=sqrt(n);
 a=b;
 if(a==b)
 {
     printf("%d",2*a);
 }
 else
 {
     c=a+1;
     if(n<pow(c,2) && n>=pow(c,2)-a)
     {
         printf("%d",2*c);
     }
     else
     {
         printf("%d",2*c-1);
     }
 }
}

#include<stdio.h>
#include<math.h>
main()
{
 int n,a,c;
 float b;
 scanf("%d",&n);
 b=sqrt(n);
 a=b;
 if(a==b)
 {
     printf("%d",2*a);
 }
 else
 {
     c=a+1;
     if(n>a*a && n<=a*a+a)
     {
         printf("%d",2*a+1);
     }
     else
     {
         printf("%d",2*a+2);
     }
 }
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n>1)
    printf("%d",n/2+2+n%2);
    else
        printf("2");
    return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n==1)
        printf("2");
    else if(n==2)
        printf("3");
    else
    printf("%d",n);
    return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n>1)
    printf("%d",((n-1)/2)+3);
    else
        printf("2");
    return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    printf("%d",n/2+2);
    return 0;
}

#include <stdio.h>

int main(void)
{
    int n,i,j;
    scanf("%d",&n);
    if(n==1)
        printf("2");
    else if(n==2)
        printf("3");
    else
    {
        if(n%2!=0)
            n++;
        for(i=4,j=4;i<=n;i+=2,j++);
        printf("%d",--j);
    }
    return 0;
}

#include <stdio.h>

int SEGMENTS(int k)
{
int total , p , required ;
p=2;
total = 1 ;
while(1)
{
total= total + p/2 ;
if (k<total)
{
    required = p ;
    break ;
}
p = p+1 ;
}
return required ;

}

int main()
{
int t= 2;
int m = SEGMENTS(t) ;
printf("%d",m);

}

#include <stdio.h>

int SEGMENTS(int k)
{
int total , p , required ;
p=2;
total = 1 ;
while(1)
{
total= total + p/2 ;
if (k<total)
{
    required = p ;
    break ;
}
p = p+1 ;
}
return required ;

}

int main()
{
int t= 1;
int m = SEGMENTS(t) ;
printf("%d",m);

}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,x1,y1,k,sum2,min,f,r,o,sum1,sum=0,y,count1,a[100000]={0};
scanf("%lld",&n);
count=1;
sum=1;
if(n==1){
    printf("2\n");
    return 0;
}
k=2;
while(1){
    count++;
    f=count*count;
    f-=count;

    if(f>=n){
        printf("%lld",k+1);
        return 0;
    }
    if(count*count<=n){
        k+=2;
        printf("%lld",k);
        return 0;
    }

    k+=2;
}

return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};

scanf("%lld",&n);
if(n==1 || n==2){
    printf("2");
}else{
    i=2;
while(i*i<n){
    i++;
}
printf("%lld",2*i);
}
return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};

scanf("%lld",&n);
flag=flag1=0;
for(i=0;i<n;i++){
    for(j=0;j<n;j++){
        scanf("%lld",&a[i][j]);
        if(a[i][j]==0){
            flag=i;
            flag1=j;
        }else{
        a2[i]+=a[i][j];
        b2[j]+=a[i][j];
        }
    }
}

if(flag+1<n){
    sum=0;
    sum=a2[flag+1]-a2[flag];
    a2[flag]+=sum;
    b2[flag1]+=sum;
}else{
     sum=0;
  //   printf("%lld %lld %lld\n",a2[flag-1],a2[flag],a2[flag-1]-a2[flag]);
    sum=a2[flag-1]-a2[flag];
    a2[flag]+=sum;
    b2[flag1]+=sum;
}

  for(i=0;i<n-1;i++)
  {

      if(a2[i]!=a2[i+1] || a2[i]!=b2[i] || b2[i]!=b2[i+1] || b2[i]==0 || a2[i]==0 || sum==0){
          printf("-1");
          return 0;
      }
  }

  printf("%lld",sum);
return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,flag1=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[500][500],b,count1=0,a2[500]={0},b2[500]={0};

scanf("%lld",&n);
if(n==1 || n==2){
    printf("%lld",n+1);
}else{
    i=2;
while(i*i<n){
    i++;
}
printf("%lld",2*i);
}
return 0;
}

#include <stdio.h>

#define min(A, B) ((A) < (B) ? (A) : (B))

int main() {
	int n;

	scanf("%d", &n);
	printf("%d\n", min(n + 1, ((n + 1) / 2) + 2));
	return 0;
}

#include<stdio.h>
int main()
{
    long long int n,ans,i,ara[100001];
    scanf("%lld",&n);
    ara[1]=2;
    for(i=2;i<=100000;i++)
    {
       ara[i]=ara[i-1]+i/2;
    }
    for(i=0;;i++)
    {
        if(n==ara[i])
        {
            printf("%lld\n",i+1);
            break;
        }
        else if(n<ara[i])
        {
            printf("%lld\n",i);
            break;
        }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int n,ans;
    scanf("%lld",&n);
    if(n<=3)
        ans=n+1;
    else
    {
        if(n%2==0)
        {
            ans=4+(n-4)/2;
        }
        else
        {
            ans=4+(n+1-4)/2;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

#include <stdio.h>

int main(void) {
    int x, z, i, j;
    scanf("%d", &x);
    z = 2 * x;
    for (i = 1; i * i <= x; ++i) {
        if (x % i == 0) {
            j = x / i;
            if (i + j < z) {
                z = i + j;
            }
        }
    }
    printf("%d", z);
    return 0;
}

#include <stdio.h>
#include <math.h>
int solve(int n)
{
    int res;
    int tmp = sqrt((double)n);
    for(int i = tmp; i >= 1; i--)
        if(n%i==0)
        {
            res = n/i + i;
            break;
        }

    return res;
}
int main()
{
    int n;
    scanf("%d",&n);
    printf("%d\n",solve(n));
    return 0;
}

#include <stdio.h>
#include <string.h>
int main()
{
    char s[222];
    int n;
    scanf("%s",s);
    scanf("%d",&n);
    int len = strlen(s);
    int low = len,high = len,m = len;
    for(int i = 0;i < len;i++)
    {
        if(s[i]=='?') {low += 1;m--;}
        if(s[i]=='*') {high = 10000;m--;}
    }
    low = m-low;
    if(high!=10000) high = m;
    printf("%d %d %d\n",low,high,n);
    if(n>high || n<low) printf("Impossible\n");
    else
    {
        if(n>m)
        {
            int flag = 0;
            for(int i = 0;i < len-1;i++)
            {
                if(s[i]!='?' && s[i]!='*')
                {
                    if(s[i+1]=='*')
                    {
                        if(flag==0)
                        {
                            for(int j = 0;j < n-m;j++) printf("%c",s[i]);
                            flag = 1;
                        }
                    }
                    else printf("%c",s[i]);
                }
            }
            if(s[len-1]!='?' && s[len-1]!='*') printf("%c",s[len-1]);
            printf("\n");
        }
        else
        {
            int flag = m-n;
            for(int i = 0;i < len-1;i++)
            {
                if(s[i]!='?' && s[i]!='*')
                {
                    if(s[i+1]=='?'&&flag>0) flag --;
                    else printf("%c",s[i]);
                }
            }
            if(s[len-1]!='?' && s[len-1]!='*') printf("%c",s[len-1]);
            printf("\n");
        }
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
int main()
{
    char s[222];
    int n;
    scanf("%s",s);
    scanf("%d",&n);
    int len = strlen(s);
    int low = len,high = len,m = len;
    for(int i = 0;i < len;i++)
    {
        if(s[i]=='?') {low += 1;m--;}
        if(s[i]=='*') {high = 10000;m--;}
    }
    low = m-low;
    if(high!=10000) high = m;
    //printf("%d %d %d\n",low,high,n);
    if(n>high || n<low) printf("Impossible\n");
    else
    {
        if(n>m)
        {
            int flag = 0;
            for(int i = 0;i < len-1;i++)
            {
                if(s[i]!='?' && s[i]!='*')
                {
                    if(s[i+1]=='*')
                    {
                        if(flag==0)
                        {
                            for(int j = 0;j < n-m;j++) printf("%c",s[i]);
                            flag = 1;
                        }
                    }
                    else printf("%c",s[i]);
                }
            }
            if(s[len-1]!='?' && s[len-1]!='*') printf("%c",s[len-1]);
            printf("\n");
        }
        else
        {
            int flag = m-n;
            for(int i = 0;i < len-1;i++)
            {
                if(s[i]!='?' && s[i]!='*')
                {
                    if(s[i+1]=='?'&&flag>0) flag --;
                    else printf("%c",s[i]);
                }
            }
            if(s[len-1]!='?' && s[len-1]!='*') printf("%c",s[len-1]);
            printf("\n");
        }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    if(n==1||n==2)
        printf("%d", n+1);
    else
        printf("%d", n);
}

#include <stdio.h>
int main()
{
	long long int n;
	scanf("%lld", &n);
	if(n==1)
	{
		printf("2\n");
	}
	else if(n==2)
	{
		printf("3\n");
	}
	else if(n==3)
	{
		printf("4\n");
	}
	else if(n==4)
	{
		printf("4\n");
	}
	else
	{
		printf("%lld\n", 4+(n-3)/2);
	}
}

#include <stdio.h>
int main()
{
	long long int n, cnt=3;
	scanf("%lld", &n);
	if(n==1)
	{
		printf("2\n");
	}
	else if(n==2)
	{
		printf("3\n");
	}

	else
	{
		int sum=2, f=0, q=2, temp=0;
		while(1)
		{
			if(sum>=n&&temp<n)
				break;
			//printf("%d\n", sum);
			temp=sum;
			sum+=q;
			if(f==1)
			{
				q++;
				f=0;
			}
			if(f==0)
			{
				f=1;
				cnt++;
			}

		}

		printf("%lld\n",cnt);
	}
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    int m = sqrt(n);
    printf("%d\n", m + n / m + (m * m != n));
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    int m = sqrt(n);
    printf("%d\n", m + m + (m * m != n));
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    if(n == (int)sqrt(n) * (int)sqrt(n)) {
        printf("%d", ((int)sqrt(n)) * 2);
        return 0;
    }
    for(int i = sqrt(n); i > 0; --i) {
        if(n % i == 0) {
            int ans = i + n / i;
            if(ans > ((int)sqrt(n) + 1) * 2) {
                ans = ((int)sqrt(n) + 1) * 2;
            }
            printf("%d\n", ans);
            break;
        }
    }
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    if(n == 2) {
        printf("%d\n", 3);
    } else {
        int m = sqrt(n);
        printf("%d\n", m + n / m + (m * m != n));
    }
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    for(int i = sqrt(n); i > 0; --i) {
        if(n % i == 0) {
            printf("%d\n", i + n / i);
            break;
        }
    }
    return 0;
}

#include<stdio.h>
int main(){
	int a;
	while(scanf("%d",&a)!=EOF){
		int sum=3;
		if(a==1){
			printf("1\n");
		}
		else if(a==2){
			printf("3\n");
		}
		else{
			printf("%d\n",(a-2)/2+sum);
		}
	}
}

#include <stdio.h>

int main(void)
{
 int n,seg,i,sq1=2,sq2=2;
 scanf("%d",&n);
 if(n<4)
  printf("%d",1+n);
 else if(n==4)
  printf("%d",n);
 else
 {
  for(i=sq1+sq2;(sq1*sq2)<n;i=sq1+sq2)
  {
   if(sq1==sq2)
    sq2++;
   else
    sq1++;
   printf("\nl %d r %d\n",sq1,sq2);
  }
  printf("%d",i);
 }
}

#include <stdio.h>

int main(void)
{
 int n,seg,i,sq1=2,sq2=2;
 scanf("%d",&n);
 if(n<4)
  printf("%d",1+n);
 else if(n==4)
  printf("%d",n);
 else
 {
  for(i=4;(sq1*sq2)<n;i=i+sq1)
  {
   if(sq1==sq2)
    sq2++;
   else
    sq1++;
  }
  printf("%d",i);
 }
}

#include<stdio.h>
int main()
{
    int n,a,min,i;
    scanf("%d",&n);
    min=n+1;
    for(i=1;i<n;i++)
    {
        if(n%i==0)
        {
            a=n/i;
            min=min<a+i?min:a+i;
        }
    }
    printf("%d\n",min);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,a,min,i;
    scanf("%d",&n);
    min=n+1;
    for(i=1;i<n;i++)
    {
        if(n%i==0)
        {
            a=n/i;
            min=min<a+i?min:a+i;
        }
    }
    printf("%d",min);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,a,min,i=1;
    scanf("%d",&n);
    min=n+1;
    for(i=i;i<n;i++)
    {
        if(n%i==0)
        {
            a=n/i;
            min=min<a+i?min:a+i;
        }
    }
    printf("%d",min);
}

#include<stdio.h>
int main()
{
    int n,a,min,i;
    scanf("%d",&n);
    min=n+1;
    for(i=1;i<=n;i++)
    {
        if(n%i==0)
        {
            a=n/i;
            min=min<=a+i?min:a+i;
        }
    }
    printf("%d",min);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main ()
{
    double n,c,k,l ;
    scanf("%lf",&n);
    c=round(sqrt(n))*2;
    k=c+1;
    if (round(sqrt(n))==sqrt(n))
    {
        printf("%lf",c);
    }
    else if(round(sqrt(n))> sqrt(n))
    {
        printf("%lf",c);
    }
    else if(round(sqrt(n))<sqrt(n))
    {
        printf("%lf",k);
    }

}

#include <stdio.h>

int main(){
    int N;
    scanf("%d",&N);
    int count = 2;
    if (N==1){
        printf("%d\n",count);
        return 0;
    }
    count = 3;
    for (int i=2;i<=N;i++){
        if (i%2==0){
            continue;
        }
        else{
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}

#include <stdio.h>

#include <math.h>

int main( void )

{

    int i ;

    scanf("%d",&i) ;

    double d = i*1.0 ;

    double root = sqrt( d ) ;

    int ans = ceil(2*root) ;

    printf("%.0lf\n",ceil(2*sqrt(i*1.0))) ;

}

#include <stdio.h>

#include <math.h>

int main( void )

{

    int i ;

    scanf("%d",&i) ;

    double d = i*1.0 ;

    double root = sqrt( d ) ;

    int ans = ceil(2*root) ;

    printf("%.0lf\n",ceil(2*root)) ;

}

#include <stdio.h>

#include <math.h>

int main( void )

{

    double n ;

    scanf("%lf",&n) ;

    printf("%.0lf\n",ceil(2.0*sqrt(n))) ;

    return 0 ;

}

#include <stdio.h>

#include <math.h>

#define LL long long

int main( void )

{

    LL n ;

    scanf("%lld",&n) ;

    printf("%lld\n",2*ceil(sqrt(n))) ;

    return 0 ;

}

#include <stdio.h>

#include <math.h>

int main( void )

{

    double n ;

    scanf("%lf",&n) ;

    printf("%.0lf\n",2.0*ceil(sqrt(n))) ;

    return 0 ;

}

#include <stdio.h>

#include <math.h>

int main( void )

{

    double n ;

    scanf("%lf",&n) ;

    n = sqrt(n) ;

    n = 2*n ;

    n = ceil( n ) ;

    printf("%.0lf\n",n) ;

    return 0 ;

}

#include <stdio.h>
#include<string.h>
#include<math.h>

int main(){
    int n,x,lines;
    scanf("%d",&n);
    x=sqrt(n);
    lines=x*2;
    if(n-(x*x)>x){
        lines=lines+2;
    }
    if(n-(x*x)==0){
        lines=lines;
    }
    else{
        lines=lines+1;
    }
    printf("%d",lines);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int x,i,s;
	while(scanf("%d",&x)!=EOF){
		for(i=1;;i++){
			s=i*i;
			if(s==x){
				printf("%d\n",2*i);
				break;
			}
			else if(s>x){
				printf("%d\n",2*i-1);
				break;
			}
		}
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, l = 3;
    scanf("%d", &n);
    if(n < 3){
        printf("%d", n + 1);
        return 0;
    }
    for(int i = 2; i < n; i += 2){
        l++;
    }
    printf("%d", l);
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {

	int n;

	scanf("%d", &n);

	if (n <= 3)
		printf("%d", n + 1);
	else
		printf("%d", n);
	return 0;

}

#include<stdio.h>

int main()
{
    int n;
    scanf("%d",&n);
    if(n==1)
    printf("2");
    else if(n==2)
    printf("3");
    else
    {
    int tmp=(n+1)/2;
    int nn=tmp-2;
    int ans=nn+4;
    printf("%d",ans);
    }
    return 0;
}

#include<stdio.h>
#include<math.h>

int main()
{
    double n;

    scanf("%lf",&n);

    printf("%.0lf\n",ceil(sqrt(n)*2.00));

    return 0;
}

#include <stdio.h>
int get_int();

int max(int a, int b)
{
	if (a > b)
	{
		return a;
	}
	return b;
}

int min(int a, int b)
{
	if (a < b)
	{
		return a;
	}
	return b;
}

int main()
{
	int i, j;
	int n = get_int();
	i = 1;
	int r = 2000000000;
	while (i*i <= n)
	{
		if (n%i == 0)
		{
			j = n/i;
			r = min(r, j + i);
		}
		i++;
	}
	printf("%d\n", r);

	return 0;
}

int get_int()
{
	int ret = 0;
	char c  = getchar();
	int sgn;

	while (1)
	{
		if (c == EOF)
		{
			return EOF;
		}
		if (c >= '0' && c <= '9')
		{
			sgn = 1;
			break;
		}
		if (c == '-')
		{
			c = getchar();

			if (c < '0' || c > '9')
			{
				continue;
			}

			sgn = -1;
			break;
		}
		c = getchar();
	}

	while (1)
	{
		ret = (ret << 3) + (ret << 1) + c - '0';

		c = getchar();

		if (c < '0' || c > '9')
		{
			return sgn*ret;
		}
	}
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int x,n;
    scanf("%d",&n);
    x=(int)sqrt(n);
    (n>x*x+x)?printf("%d",2*x+2):(n=x*x)?printf("%d",2*x):printf("%d",2*x+1);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int x,n;
    scanf("%d",&n);
    x=(int)sqrt(n);
    (n>x*x && n<=x*x+x)?printf("%d",2*x+1):(n=x*x)?printf("%d",2*x):printf("%d",2*x+2);
    return 0;
}

#include<stdio.h>

#define mod 998244353

int main(void) {
    int n;
    scanf("%d", &n);
    int d=4;
    if(n == 1) {
        printf("2");
    } else if (n <= 3) {
        printf("3");
    } else if (n == 4)  {
        printf("4");
    } else {
        int r = 2;
        int flag = 1;
        for(int i = 4; i< n; ) {
            d++;
            i += r;
            r += flag;
            flag = 1 - flag;
        }
        printf("%d", d);
    }

    return 0;
}

#include <stdio.h>

int main()
{
    int n,k=2,cnt=3,c=0,p,i;
    scanf("%d",&n);
    if(n==1)
    printf("2");
    else if(n==2)
    printf("3");
    else
    {
        for(i=3;i<=n;i=i+k)
        {
            p=cnt;
           cnt++;
           if(cnt>p)
           c++;
           if(c==2)
           {k++;
           c=0;}
        }
        printf("%d",cnt);
    }

    return 0;
}

#include <stdio.h>

int main()
{
    int n,k=2,cnt=3,c=0,p,i;
    scanf("%d",&n);
    if(n==1)
    printf("2");
    else if(n==2)
    printf("3");
    else
    {
        for(i=3;i<=n;i=i+k)
        {
            p=cnt;
           cnt++;
           if(cnt>p)
           c++;
           if(c==k)
           {k++;
           c=0;}
        }
        printf("%d",cnt);
    }

    return 0;
}


On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.

The first line of the input contains a positive integer n (1 ≤ n ≤ 1 000 000) — the number of days in a year on Mars.

Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.

NoteIn the first sample there are 14 days in a year on Mars, and therefore independently of the day a year starts with there will be exactly 4 days off .In the second sample there are only 2 days in a year on Mars, and they can both be either work days or days off.

#include <stdio.h>

int main ()
{
    int min=0, max=0, days, i;
    scanf("%i",&days);
    for(i=0;i<days;i++)
        if(i%7>4)
            min++;
    for(i=0;i<days;i++)
        if(i%7==0 || i%7==1)
            max++;
    printf("%i %i",min, max);
}

#include<stdio.h>
#include<math.h>

int main()
{
    int n, min, max;
    scanf("%i", &n);

    if(n>=7)
    {
        max = ((n/7)*2);
        if(n%7 > 2){
           // printf("el numero es %i \n", (n%7));
            max+= 2;
        }
        else
            max += n%7;

        min = ((n/7)*2) + ((n%7)/6);
    }

    if(n<7)
    {
        max = n == 1 ? 1 : 2;
        min = n/6;
    }

    printf("%i %i", min, max);
}

#include <stdio.h>

int main(){
	unsigned int n;
	unsigned int min;
	unsigned int max;
	scanf("%u",&n);
	min=n/7*2;
	if(n%7>=2){
		max=2;
		if(n%7==6){
			min++;
			max--;
		}
	}else{
		max=n%7;
	}
	printf("%u %u",min,min+max);

}

#include<stdio.h>

int main(){
int n, min, max, temp;
scanf("%d", &n);
min=(n/7)*2;
temp=n%7;
if(temp!=0){
	if(temp==1){
		max=min+1;
		min=min;
	}

	else if(temp==6){
		max=min+2;
		min=min+1;
	}

	else{
		min=min;
		max=min+2;
	}
}
else{
	max=min;
}
printf("%d %d",min,max);
}

#include<stdio.h>
int main(){
    long int n,max,min,m;
    scanf("%ld",&n);
    m=(n/7)*2;
    min=m;
    n=n%7;
    if(n%7>2){
        if(n==6){
           min=m+1;
        }
        max=m+2;
    }
    else {
        max=m+n%7;
    }
    printf("%ld %ld",min,max);
}

#include <stdio.h>
// ko co nam nhuan
// tuan 7 ngay 2 ngay nghi
int main()
{
	int n;
	scanf("%d",&n);
	int min,max;
	min=n/7*2;
	max=n/7*2;
	// TH dac biet:
	if(n%7!=0)
	{
		if( n%7-5>0 ){
			min=min+n%7-5;
		}

		if( n%7<=2 ){
			max=max+n%7;
		}
		else{
			max=max+2;
		}
	}
	printf("%d %d",min,max);
	return 0;
}

#include<stdio.h>
int main(){
	int n;
	scanf("%d", &n);
	int max, min;
	int r=n%7, s=n/7;
	if(r==1) {
		min=s*2;
		max=2*s+1;
	}
	else if(r==6){
		min=2*s+1;
		max=2*s+2;
	}
	else if(r==0){
		min=2*s;
		max=min;
	}
	else{
		min=2*s;
		max=2*s+2;
	}
	printf("%d %d", min, max);
}

#include<stdio.h>
int ngaynghitoithieu(int n){
	int t=n/7;
	int k=n%7;
	if(k==6) printf("%d ",2*t+1);
	else printf("%d ",2*t);
}
int ngaynghitoida(int n){
	int t=n/7;
	int k=n%7;
	if(k==1) printf("%d",2*t+1);
	else if(k==0) printf("%d",2*t);
	else printf("%d",2*t+2);
}
int main(){
	int n;
	scanf("%d",&n);
	ngaynghitoithieu(n);
	ngaynghitoida(n);
	return 0;
}

#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int b=n/7;
int c=n%7;
int max=2*b;
int min=2*b;
if(c==1)
max=max+1;
if(c==2)
max=max+2;
if(c==3)
max=max+2;
if(c==4)
max=max+2;
if(c==5)
{
max=max+2;
}
if(c==6)
{
max=max+2;
min=min+1;
}
printf("%d %d",min,max);
return 0;
}

#include<stdio.h>
int main(void)
{
    long long int days, x, y, min, max;
    scanf("%lld", &days);
    if(days > 1)
    {
    x = days%7;
    y = days/7;
    if(x != 0 && x < 6 && x >1)
    {
        max = y*2 + 2;
        min = y*2;
    }
    else if(x != 0 && x==6)
    {
        max = y*2 + 2;
        min = y*2 + 1;
    }
    else if(x != 0 && x==1)
    {
        max = y*2 + 1;
        min = y*2;
    }
    else
    {
        max = y*2;
        min = y*2;
    }
    }
    else
    {
        max = days;
        min = 0;
    }
    printf("%lld %lld", min, max);
    return 0;
}

#include<stdio.h>
int main()
{
	int n,min,max;
	scanf("%d",&n);
	if(n%7==1)
	{
		min=(n/7)*2;
		max=min+1;
	}
	else if(n%7==0)
	{
		min=(n/7)*2;
		max=(n/7)*2;
	}
	else if(n%7==6)
	{
		min=(n/7)*2+1;
		max=min+1;
	}
	else
	{
		min=(n/7)*2;
		max=min+2;
	}
	printf("%d %d",min,max);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{
  long long int i,j,k,l,m,n,max=0,min=0;
  //printf("enter the number\n");
  scanf("%lld",&n);
  if(n%7==0) min=max=(n/7)*2;
  else {
    l=n/7;
    m=n%7;l=l*2;
    min=l;
    if(m==6) min++;
    if(m>1) l=l+2;
    else l++;
    max=l;
  }
  printf("%lld %lld",min,max);
}

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int tuan=n/7;
	if(n%7==6)
		printf("%d ",2*tuan+1);
	else
		printf("%d ",2*tuan);
	if(n%7==1)
		printf("%d",2*tuan+1);
	else if(n%7>=2)
		printf("%d",2*tuan+2);
	else
		printf("%d",2*tuan);
	return 0;
}

#include <stdio.h>
int main()
{
    unsigned int n, max, min;
    scanf("%u", &n);
    max = (n / 7) * 2;
    min = max;
    if(n % 7 > 1){ max += 2; }
    else{ max += n % 7; }
    if(n % 7 == 6){ min++; }
    printf("%u %u", min, max);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x;
    int week;
    int flag = 1;
    int holiday = 0;
    scanf("%d",&x);

    week = x / 7;
    x = x % 7;
    if(x > 1 && x <= 5){
        printf("%d\t",0 + (week * 2));
        printf("%d",2 + (week * 2));
    }
    else if(x == 1){
        printf("%d\t",0 + (week * 2));
        printf("%d",1 + (week * 2));
        }
    else if(x == 6){
        printf("%d\t",1 + (week * 2));
        printf("%d",2 + (week * 2));
        }
    else{
        printf("%d\t",0 + (week * 2));
        printf("%d",0 + (week * 2));
        }

    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,min,max;
scanf("%d",&n);
a=n/7;
b=n%7;
min=a*2;
max=a*2;
if(b<=5)
min=min;
if(b==6)
min=min+1;
if(b==1)
max=max+1;
else if(b>1 && b<=6)
max=max+2;
printf("%d %d",min,max);
return 0;
}

#include <stdio.h>

int main (){
int a=0,b=0,n=0,min=0,max=0;

scanf("%d",&n);

b=n/7;
a=n%7;

switch (a){
    case 1:
min=0;
max=1;
    break;
    case 2:
min=0;
max=2;
    break;
    case 3:
min=0;
max=2;
    break;
    case 4:
min=0;
max=2;
    break;
    case 5:
min=0;
max=2;
    break;
    case 6:
min=1;
max=2;

    break;
    case 0:
min=2;
max=2;
    break;
}

if (b==0){
min=min+2*(b);
max=max+2*(b);
}
else if(a!=0){
min=min+2*b;
max=max+2*b;
}
else {
min=min+2*(b-1);
max=max+2*(b-1);
}

printf("%d\n%d\n",min,max);

return 0;
}

#include <stdio.h>

int main ()
{
    int min=0, max=0, days, i;
    scanf("%i",&days);
    for(i=0;i<days;i++)
        if(i%7>4)
            min++;
    for(i=0;i<days;i++)
        if(i%7==0 || i%7==1)
            max++;
    printf("%i %i",min, max);
}

#include<stdio.h>
int main()
{
	int n,a,b,c,min,max;
	scanf("%d",&n);

	if(n%7==0)
	{
		a=n/7;
		b=a*2;
		printf("%d %d",b,b);

	}
	else
	{
		a=n/7;
		b=n%7;
		if (b==6)
		{
			c=a*2;
		    max=c+2;
		    min=c+1;
		    printf("%d %d",min,max);
            }
	    else if(b<=5 & b!=1)
        {
        	c=a*2;
        	max=c+2;
        	min=c;
        	printf("%d %d",min,max);
	        }
	    else if(b==1)
	    {
	    	c=a*2;
	    	min=c;
	    	max=c+1;
	    	printf("%d %d",min,max);
		    }
	}
}

#include<stdio.h>

int main()
{
    long long n,t;
    register long long min,max;
    scanf("%I64d",&n);
    t=n/7;
    min=t*2;
    max=min;
    if((n+1)%7==0)
        min++;
    if(n%7==1)
    max++;

    if(n%7>=2)
        max+=2;
    printf("%I64d %I64d\n",min,max);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    long long int min,max;
    min=2*(n/7);
    if(n%7==6)
    {
        min+=1;
    }
    if(n%7>=2)
    {
        max=2*(n/7)+2;
    }
    else{
        max=2*(n/7)+n%7;
    }
    printf("%lld %lld",min,max);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    long n;
    scanf("%ld", &n);
    if (n % 7 == 6) printf("%ld ", n / 7 * 2 + 1);
    else printf("%ld ", n / 7 * 2);
    if (n % 7 == 0) printf("%ld\n", n / 7 * 2);
    else if (n % 7 == 1) printf("%ld\n", n / 7 * 2 + 1);
    else printf("%ld\n", n / 7 * 2 + 2);
    return 0;
}

#include<stdio.h>

int main(){

        int input,rem,min,max;

        scanf("%d",&input);

        rem=input%7;

        if (rem==6){

            min=(input/7)*2+1;
            max=(input/7)*2+2;

            printf("%d %d",min,max);
        }

        else if (rem==1){
               min= (input/7)*2;
                max=(input/7)*2+1;

                printf("%d %d",min,max);
        }

        else if (rem==0){
               min= (input/7)*2;
                max=(input/7)*2;

                printf("%d %d",min,max);
        }

       else  if (rem>1 && rem <6){

            min=(input/7)*2;
            max=(input/7)*2+2;

            printf("%d %d",min,max);
        }
       // printf("%d",rem);

}

#include<stdio.h>

int main()
{

long long days,max,min;
scanf("%lld",&days);

min=(days/7)*2;
if(days%7==6){min=(days/7)*2+1;}

if(days%7==0){max=min;}
else if(days%7==1){max=(days/7)*2+1;}
else if(days%7>=2){max=(days/7)*2+2;}
printf("%lld %lld",min,max);
return 0;
}

#include<stdio.h>

int main()
{
    long long int n;
    int max,min;
    scanf("%I64d",&n);
    min=(n/7)*2;
    if(n%7==6)
        min++;
    if(n%7==1)
        max=(2*(n/7))+1;
    else if(n%7==0)
        max=min;
    else
        max=(2*(n/7))+2;
    printf("%d %d",min,max);
    return 0;
}

#include<stdio.h>

struct n{
    int x;
    struct n *next;
}*head;

int main()
{
    head=(struct n *)malloc(sizeof(struct n));
    head->x=0;
    head->next=(struct n *)malloc(sizeof(struct n));
    head->next->x=0;
    long n, a;
    scanf("%d", &n);
    for(long i=1; i<=n; i++)
    {
        a=i%7;
        if(a==1 || a==2)
            head->next->x++;

        if(a==6 || a==0)
            head->x++;
    }
    printf("%d %d", head->x, head->next->x);
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,a,b;
    scanf("%d",&n);
    a=n/7*2;
    b=n/7*2;
    if(n%7==1)a=a+1;
    else if(n%7>=2)a=a+2;
    if(n%7==6)b++;

    printf("%d %d",b,a);

    return 0;
}

#include<stdio.h>

int main(){

        int input,rem,min,max;

        scanf("%d",&input);

        if (1<=input && input<=1000000){

        rem=input%7;

        if (rem==6){

            min=(input/7)*2+1;
            max=(input/7)*2+2;

            printf("%d %d",min,max);
        }

        else if (rem==1){
               min= (input/7)*2;
                max=(input/7)*2+1;

                printf("%d %d",min,max);
        }

        else if (rem==0){
               min= (input/7)*2;
                max=(input/7)*2;

                printf("%d %d",min,max);
        }

       else  if (rem>1 && rem <6){

            min=(input/7)*2;
            max=(input/7)*2+2;

            printf("%d %d",min,max);
        }
       // printf("%d",rem);

        }

        else {
            return 0;
        }

}

#include<stdio.h>
int main()
{
    int n;
    int min, max, rem;
    scanf("%d", &n);
    rem =n % 7;
    max = min = 2 * (n/7);
    if(rem == 1){
        max  =min + 1;
    } else if (rem>=2 && rem<6){
        max = min + 2;
    }else if(rem == 6){
        min += 1;
        max += 2;
    }
    printf("%d %d\n", min, max);
    return 0;
}

#include <stdio.h>

int main(){
	int n,min,max;
	scanf("%d",&n);
	if(n%7==6){
		min=(n/7)*2+1;
	}
	else {
		min=(n/7)*2;
	}
	if(n%7==1){
		max=min+1;
	}
	else if(n%7>=2){
		if(n%7==6){
			max=min+1;
		}
		else{
			max=min+2;
		}
	}
	else {
		max=min;
	}
	printf("%d %d",min,max);
	return 0;
}

#include<stdio.h>
main()
{
    int n,min,max;
    scanf("%d",&n);
    switch(n%7)
    {
        case 0:{
        max=n*2/7;
        min=n*2/7;
        printf("%d %d",min,max);
        }
        break;
        case 1:{
        max=n*2/7+1;
        min=n*2/7+0;
        printf("%d %d",min,max);
        }
        break;
        case 2:{
        max=n*2/7+2;
        min=n*2/7+0;
        printf("%d %d",min,max);
        }
        break;
        case 3:{
        max=n*2/7+2;
        min=n*2/7+0;
        printf("%d %d",min,max);
        }
        break;
        case 4:{
        max=n*2/7+1;
        min=n*2/7-1;
        printf("%d %d",min,max);
        }
        break;
        case 5:{
        max=n*2/7+1;
        min=n*2/7-1;
        printf("%d %d",min,max);
        }
        break;
        case 6:{
        max=n*2/7+1;
        min=n*2/7;
        printf("%d %d",min,max);
        }
        break;
    }
}

#include<stdio.h>
 int main()
{
	int n,k,p,min,max;
scanf("%d",&n);
if(n>=7)
{
	k=n/7;
	p=n%7;
	if(p%7==6){
		min=2*k+1;
	}else
	min=2*k;
	if(p<=2)
	max=min+p;
	else if(p>2)
	max=2*k+2;
}
else if(n<7)
{ if(n<=2){
     min=0;
     max=n;
	}else if(n>2&&n<6)
	{
		min=0;max=2;
	}else if(n==6)
	{
		min=1;max=2;
	}

}printf("%d %d",min,max);}

#include<stdio.h>
int main()
{
    int n,a,b,max,min;
    scanf("%d", &n);
    if (n==1){
        printf("0 1");
    }
    else if (n ==6){
        printf("1 2");
    }
    else if ( n<7){
        printf("0 2");
    }
    else {
    b= n/7;
    a=2*b;
    if (n%7==0){
        max=a;
        min=a;
    }
    else if (n%7==1){
        max=a+1;
        min=a;
    }
    else if (n%7==6){
        max=a+2;
        min=a+1;
    }
    else{
        max=a+2;
        min=a;
    }
    printf("%d %d\n", min, max);
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<malloc.h>
#include<math.h>
int main(){
    int days;
    int i,j,k;
    int min,max;
    while(~scanf("%d",&days)){
            int num=days%7;
            min=days/7;
            min*=2;
        if(num<=2){
            max=days%7+min;
        }
        else if(num==6){
            max=2+min;
            min+=1;
        }
        else
            max=2+min;
        printf("%d %d\n",min,max);
    }
    return 0;
}

#include<stdio.h>
int main(){
	int n,min,max;
	scanf("%d",&n);

	min=(n/7)*2;
	max=min;
	if(n%7==6){min++;max+=2;}
	else{
		if(n%7==1){max++;}
		else if(n%7){max+=2;}
	}
	printf("%d %d\n",min,max);

}

#include<stdio.h>

int main()
{
	long long int n;
	scanf("%lld",&n);
	long long int x=0;
	long long int y=0;
	long long int z=0;
	if(n%7==0)
	{
		z=n/7;
		x=2*z;
		y=2*z;
		printf("%lld %lld",x,y);
	}
	else if(n%7==1)
	{
		z=n/7;
		x=2*z;
		y=x+1;
		printf("%lld %lld",x,y);
	}
	else if(n%7==2)
	{
		z=n/7;
		x=2*z;
		y=x+2;
		printf("%lld %lld",x,y);
	}
	else if(n%7==3)
	{
		if(n>7)
		{
			z=n/7;
			x=2*z;
			y=x+2;
			printf("%lld %lld",x,y);
		}
		else
			printf("0 2");
	}
	else if(n%7==4)
	{
		if(n>7)
		{
			z=n/7;
			x=2*z;
			y=x+2;
			printf("%lld %lld",x,y);
		}
		else
			printf("0 2");
	}
	else if(n%7==5)
	{
		if(n>7)
		{
			z=n/7;
			x=2*z;
			y=x+2;
			printf("%lld %lld",x,y);
		}
		else
			printf("0 2");
	}
	else if(n%7==6)
	{
		if(n>7)
		{
			z=n/7;
			x=2*z+1;
			y=x+1;
			printf("%lld %lld",x,y);
		}
		else
			printf("1 2");
	}
	return 0;
}

#include <stdio.h>

int main(void) {
    long long n,i;
    scanf("%lld",&n);
    int count = 0,min = 0;
    for(i=0;i<n;i=i+7){
        if(n-i==1){
            count++;
        }
        else
            count = count + 2;
        if(i>4){
            min = min + 2;
        }
    }
    if(n>5){
        if(n==6){
            min++;
        }
        else if(n%7==0){
            min = min + 2;
        }
        else if(n%7==6){
            min++;
        }
    }
    printf("%d %d",min,count);
 	return 0;
}

#include<stdio.h>

int main()
{
    int n, day, days;

    scanf("%d", &n);

    if(n%7==0)
        printf("%d %d\n", (n/7)*2, (n/7)*2);
    else
    {
        day = n / 7;
        days = n-day*7;

         if(days==6)
            printf("%d %d\n", (day*2)+1, (day*2)+2);
        else if(days>=2)
            printf("%d %d\n", day*2, (day*2)+2);
        else
            printf("%d %d\n", day*2, (day*2)+1);
    }
    return 0;
}

#include <stdio.h>
int main ()
{
    int n,off;
    scanf("%d",&n);
    if (n/7==0)
    {
        if (n==1)
        {
            printf("0 1");
            return 0;
        }
        else if(n==6)
        {
            printf("1 2");
            return 0;
        }
        else
        {
            printf("0 2");
            return 0;
        }
    }
    else
    {
        off = (n/7)*2;
        if (n%7==0)
        {
            printf("%d %d",off,off);
        }
        else if (n%7==1)
        {
            printf("%d %d",off,off+1);
        }
        else if (n%7==6)
        {
            printf("%d %d",off+1,off+2);
        }
        else
        {
            printf("%d %d",off,off+2);
        }
    }
    return 0;
}

#include<stdio.h>
int main() {
      int n, max_off_day = 0, min_off_day = 0;
      scanf("%d", &n);

      max_off_day += 2 * (n / 7);
      min_off_day += 2 * (n / 7);

      if (n % 7 != 0) {
            if ((n % 7 >= 2))max_off_day += 2;
            else if ((n % 7) == 1) max_off_day++;
            if ((n % 7) == 6) min_off_day++;
      }

      printf("%d %d\n", min_off_day, max_off_day);
}

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

    int n,temp,left,count,max;
    scanf("%d",&n);

    temp=n/7;
    left=n%7;
    count=temp*2;

    if(left==6)
    {
    	count=count+1;
    	printf("%d %d\n",count,count+1);
    }

    else
    {

    if(left==1)
    {
    	max=count+1;
    }
    else if(left==2)
    {
    	max=count+2;
    }

    else if(left==0)
    {
    	max=count;
    }
    else if(left>=3)
    {
    	max=count+2;
    }
    printf("%d %d\n",count,max );

}

}

#include<stdio.h>
#include<conio.h>
int cmin(int a)
{int i,hol=0;
for(i=1;i<=a;i++)
{if(i%7==0||i%7==6)
hol++;

}
return hol;
}
int cmax(int a)
{int i,hol;
if(a==1)
    hol=1;
else
    hol=2;
for(i=1;i<=a-2;i++)
if(i%7==0||i%7==6)
hol++;

return hol;
}
int main()
{int b,c,d;
//printf("enter the no. of days in the year on mars\n");
scanf("%d",&b);
c=cmin(b);
d=cmax(b);
printf("%d ",c);
printf("%d",d);
return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,a,b,c;
    scanf("%d",&n);

    if((n>0)&&(n<=1000000))
    {

    a=(n/7)*2;

    b=n%7;

switch (b) {
case 0:
printf("%d %d",a,a);
break;
case 1:
 printf("%d %d",a,a+1);
 break;
case 6:
 printf("%d %d",a+1,a+2);
 break;
default :
printf("%d %d",a,a+2);

}
    }
    return 0;
}

#include<stdio.h>

int main()
{
    int day,offday,dayleft,maxoffday,totaloffday,minimumoffday;
    scanf("%d",&day);

    if(day == 1)
    {
        printf("0 1");
        return 0;
    }
    if(day <= 5 && day >= 2)
    {
        printf("0 2");
        return 0;
    }
    if(day == 6)
    {
        printf("1 2");
        return 0;
    }

    offday = day/7;
    dayleft = day%7;

    if(day % 7 == 0)
    {
        maxoffday = offday * 2;
        minimumoffday = offday * 2;
        printf("%d %d",minimumoffday,maxoffday);
        return 0;
    }

    totaloffday = offday * 2;
    minimumoffday = totaloffday;

    if(dayleft == 6)
    {
        minimumoffday = minimumoffday + 1;
        maxoffday = totaloffday + 2;
        printf("%d %d",minimumoffday, maxoffday);
        return 0;
    }

    if(dayleft > 2)
    {
        maxoffday = totaloffday + 2;
        printf("%d %d" ,minimumoffday, maxoffday);
    }
    if(dayleft == 1)
    {
        maxoffday = totaloffday + 1;
        printf("%d %d",minimumoffday, maxoffday);
    }
    if(dayleft == 2)
    {
        maxoffday = totaloffday + 2;
        printf("%d %d",minimumoffday ,maxoffday);
    }

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, nr, ramas;
    scanf("%d", &n);
    nr=n/7;
    ramas=n%7;
    if(ramas>5)
        printf("%d %d", nr*2+(ramas-5), nr*2+2);
    else{ if(ramas>=2)
        printf("%d %d", nr*2, nr*2+2);
        else
        printf("%d %d", nr*2, nr*2+ramas);
    }

    return 0;
}

#include<stdio.h>
int main()
{
    long long n,min,max,week,weekend,rem;
    scanf("%I64d",&n);

    if(n<=2)
    {
        min=0;
        max=2;
    }
    else if(n>2&&n<=7)
    {
        min=2;
        max=2;
    }
    else if(n>7)
    {
        week=n/7;
    weekend=week*2;
    min=weekend;
    rem=n%7;
    if(rem==1)
    {
    max=weekend+1;
    }
    else if(rem>2)
    {
        max=weekend+2;
    }
    else if(rem==0)
    {
        max=min;
    }
    }
    printf("%I64d %I64d",min,max);
    return 0;

}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    long long n,min=0,max=0;
    scanf("%lld",&n);
    long long weeks= n/7;
    if(n%7==0)
        {
          max=weeks*2;
        }
    else
        {
         int rem = n%7;
          if(rem>=2)
              {
                 max= (weeks*2)+2;
              }
          else if(rem==1)
              {
                 max= (weeks*2)+1;
              }

       }
    min= weeks*2;
     printf("%lld %lld\n",min,max);

    return 0;
}

#include<stdio.h>

int max(int a, int b)
{
    if(a>=b)return a;
    return b;
}

int min(int a, int b)
{
    if(a<=b)return a;
    return b;
}

int main()
{
    int n;
    int weeks;
    int rem;
    int max_off, min_off;
    scanf("%d",&n);

    weeks = n/7;
    rem = n%7;

    max_off = weeks*2+min(rem,2);
    min_off = weeks*2+max(0,rem-7);

    printf("%d %d",min_off,max_off);

    return 0;
}

#include<stdio.h>
int main(){
	int n,max,min,left;scanf("%d",&n);
	left=n%7;
	if(left>=2){left=2;}
	max=(n/7)*2+left;
	min=(n/7)*2;
	printf("%d %d\n",min,max);
	return 0;}

#include<stdio.h>
int main()
{
    int n,i,x,j;
    scanf("%d", &n);
    i = n%7;
    x = n/7;
    if(i==0)
    {
        j=x*2;
        printf("%d %d",j,j);
    }
    else if(i!=0 && i<6 && i>1)
    {
      printf("%d %d",x,x+2);

    }
    else if(i==1)
    {
        printf("0 1");
    }
    else if(i==6)
    {
        printf("1 2");
    }
    return 0;

}

 #include<stdio.h>
#include<math.h>
int main()
{

   int i,a,b,n,A=0,B=0,AA=1,Alex=5;
   scanf("%d",&n);
   a=n/7;
   if(n<=7){a=2; b=0;}
   if(n>7){a=a*2; b=a;}
   printf("%d %d",b,a);
   return 0;

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    if (a%7==0)
    {
        b=(a/7)*2;
        printf("%d\t%d",b,b);
    }
    else if (a%7!=0)
    {
        b=(a/7);
        c=a-(b*7);
        e=b*2;
        d=c+e;
    printf("%d\t%d",e,d);
    }
    return 0;
}

#include<stdio.h>
int main(){
    long int n,max,min;
    scanf("%ld",&n);
    min=(n/7)*2;
    if(n%7>2){
        max=min+2;
    }
    else {
        max=min+n%7;
    }
    printf("%ld %ld",min,max);
}

#include<stdio.h>
int main()
{
    long long n,min,max,week,weekend,rem;
    scanf("%I64d",&n);
    if(n==0)
    {
        min=0;max=0;
    }
else if(n==1)
{
    min=0;
    max=1;
}
   else if(n<=2)
    {
        min=0;
        max=2;
    }
    else if(n>2&&n<=7)
    {
        min=2;
        max=2;
    }
    else if(n>7)
    {
        week=n/7;
    weekend=week*2;
    min=weekend;
    rem=n%7;
    if(rem==1)
    {
    max=weekend+1;
    }
    else if(rem>=2)
    {
        max=weekend+2;
    }
    else if(rem==0)
    {
        max=min;
    }
    }
    printf("%I64d %I64d",min,max);
    return 0;

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n;
    scanf("%d", &n);
    printf("%d %d", n/7*2, (n-2)/7*2+2);

    return 0;
}

#include <stdio.h>
#include<math.h>

int main()
{
    int n,a;
    scanf("%d",&n);
    a=n/7;
    if(n==6)
    {
        printf("1 2");
    }
    else if(n%7==0)
    {
        printf("%d %d",2*a,2*a);
    }
    else if(n%7==1)
    {
        printf("%d %d",2*a,2*a+1);
    }
    else
    {
        printf("%d %d",2*a,2*a+2);
    }
    return 0;
}

#include<stdio.h>

int main()
{
    int n,min,max,rem;
    scanf("%d",&n);
    min=(n/7)*2;
    rem=n%7;
    if(rem>2)
    {
        max=min+2;
    }
    else if(rem<3)
    {
        max=min+rem;
    }
    printf("%d %d",min,max);

}

#include<stdio.h>
int main()
{
    long int n,min,max,r;
    scanf("%ld",&n);
    r=n%7;
    if(n<2)
    {
        min=0;
        max=n;
    }
    else if(r==0)
    {
        min=2*(n/7);
        max=2*(n/7);
    }
    else
    {
        min=2*(n/7);
        max=2*(n/7)+2;
    }
    printf("%ld %ld",min,max);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,a,max,min;
    scanf("%d", &n);
    if (n==1){
        printf("0 1");
    }
    else if (n ==6){
        printf("1 2");
    }
    else if ( n<7){
        printf("0 2");
    }
    else {
    a=2 * n/7;
    if (n%7==0){
        max=a;
        min=a;
    }
    else{
        max=a+2;
        min=a;
    }
    printf("%d %d\n", min, max);
    }
    return 0;
}

#include <stdio.h>
int main()
{
	int n,max,min,a;
	scanf("%d",&n);
	max=min=2*n/7;
	a=n%7;
	if(a>=2){
		max= max+2;
	}
	else if ( a==1){
		max=max+1;
	}
	printf("%d %d",min,max);
	return 0;
}

#include<stdio.h>
int main(){
	int n;
	scanf("%d", &n);
	int max, min;
	int r=n%7, s=n/7;
	if(r==1) {
		min=s*2;
		max=2*s+1;
	}
	else if(r==6){
		min=2*s+1;
		max=2*s+2;
	}
	else{
		min=2*s;
		max=2*s+2;
	}
	printf("%d %d", min, max);
}

#include <stdio.h>
int main(){
	int n,x,y;
	scanf("%d",&n);
	if (n>5){
		for (int i=1;i<=n;i++){
			y=n%7+n*2/7;
		}
		for (int i=1;i<=n-5;i++){
			x=n*2/7;
		}
	printf("%d %d",x,y);
	}
	else {
		printf("0 2");
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
    int n,r,s,m;
    scanf("%d",&n);
    if(n%7==0)
    {
        s=n/7;
        s=s*2;
        m=s;
    }
    else
    {
        s=n/7;
        s=s*2;
        m=s+2;
    }
    if(n==1)
    {
        s=0;
        m=1;
    }
    if(n==6)
    {
        s=1;m=2;
    }
             printf("%d %d",s,m);
}

#include<stdio.h>
int main()
{
    int y, max, min, ex;
    while(scanf("%d", &y) != EOF) {
        if (y%7 == 0) {
            max=min=y/7*2;
            printf("%d %d\n", min, max);
        }
        else {
            min=y/7 *2;
            ex=(y%7 >=2)?2:1;
            max=min+ ex;
            printf("%d %d\n", min, max);
        }
    }
        return 0;
    }

#include<stdio.h>
#include<math.h>
int main()
{
    int n,x,y;
    scanf("%d",&n);
    if(n==1)
    {
        printf("0 1");
        return 0;
    }
    x=n/7;
    y=ceil(n*1.0/7);
    x=x*2;
    y=y*2;
    printf("%d %d",x,y);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, min = 0, max = 0;
    scanf("%d", &n);
    if(n%7 == 1)
    {
        min = n/7*2;
        max = n/7*2 +1;
    }
    if(n%7 == 0)
    {
        min = n/7*2;
        max = n/7*2;
    }
    if(n%7 >1)
    {
        min = n/7*2;
        max = n/7*2+2;
    }
    printf("%d %d", min, max);
    return 0;
}

#include<stdio.h>
int main()
{
    int n,m,max,min,a,b;
    scanf("%d",&n);

    if(n<=5 && n>0)
    {
        max=2,min=0;
        printf("%d %d\n",min,max);
    }
    else
    {
        a=n%7;
        b=n/7;
        if(a<=5&&a>0)
        {
            min=b*2;
            max=min+2;
            printf("%d %d\n",min,max);
        }
        else if(a==6)
        {

            min=(b*2)+1;
            max=min+1;
            printf("%d %d",min,max);
        }
        else
        {
            min=b*2;
            max=min;
            printf("%d %d",min,max);
        }

    }
    return 0;
}

#include<stdio.h>
int main()
{
    int i,l;
    float n,k;
    scanf("%f",&n);
    int x;
    x=n;
    k=(n/7.0)*2.0;
    l=k;
    if(l==k)
        printf("%d %d\n",l,l);
    else if (x%7<2)
        printf("%d %d\n",l,x%7);
    else
        printf("%d %d\n",l,l+2);

    return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int i,j,r;
    int c=0;
    int sum=((n/7)*2);
    int rem=n%7;
    if(n==2)
    {
        i=0;
        j=2;
        printf("%d %d",i,j);
    }
    else if(n==6)
        {
        i=1;
        j=2;
        printf("%d %d",i,j);
        }
        else if(n==3)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else if(n==4)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else if(n==5)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else
        {
            if(rem==6)
            {
                i=i+1;
            }
            else
                {
           i=sum;
                }
           if(rem==1)
           {
               j=sum+1;
           }
           else if(rem==0)
           {
               j=sum;
           }
           else
           {
               j=sum+2;
           }

            printf("%d %d",i,j);
        }
}

#include<stdio.h>
int main()
{
    long long n,min,max,week,weekend,rem;
    scanf("%lld",&n);

    if(n<=2)
    {
        min=0;
        max=2;
    }
    else if(n>2&&n<=7)
    {
        min=2;
        max=2;
    }
    else if(n>7)
    {
        week=n/7;
    weekend=week*2;
    min=weekend;
    rem=n%7;
    if(rem==1)
    {
    max=weekend+1;
    }
    else if(rem>2)
    {
        max=weekend+2;
    }
    else if(rem==0)
    {
        max=min;
    }
    }
    printf("%lld %lld",min,max);
    return 0;

}

#include <stdio.h>

int main (){
    int days, min=0, max=0;
    scanf("%i", &days);
    max=2*days/7+days%7;
    min=2*days/7;
    if (days%7>2){
        max=2*days/7+2;
    }
    if (days%7==6){
        min=2*days/7+1;
    }
    printf("%i %i", min, max);
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    long long n,min=0,max=0;
    scanf("%lld",&n);
    long long weeks= n/7;
    if(n%7==0)
        {
          max=weeks*2;
        }
    else
        {
         int rem = n%7;
          if(rem>=2)
              {
                 max= (weeks*2)+2;
              }
          else
              {
                 max= (weeks*2)+1;
              }

       }
    min= weeks*2;
     printf("%lld %lld\n",min,max);

    return 0;
}

#include <stdio.h>

int main ()
{
    int n;
    int week, min_days_off, rem, max_days_off;
    while(scanf("%d", &n)!=EOF)
    {
        week= n/7;
        min_days_off= week*2;
        rem= n%7;
        if(rem==0)
            max_days_off= min_days_off;
        //else if(rem==1)
            //max_days_off= min_days_off+1;
        else
            max_days_off= min_days_off+2;
        printf("%d %d\n", min_days_off, max_days_off);

    }
    return 0;
}

#include<stdio.h>
int main()
{
    int y, max, min, ex;
    while(scanf("%d", &y) != EOF) {
        if (y%7 == 0) {
            max=min=y/7*2;
            printf("%d %d\n", max, min);
        }
        else {
            min=y/7 *2;
            ex=(y%7 >2)?2:1;
            max=min+ ex;
            printf("%d %d\n", min, max);
        }
    }
        return 0;
    }

#include <stdio.h>
#include<math.h>

int main()
{
    int n,a;
    scanf("%d",&n);
    a=n/7;
    if(n%7==0)
    {
        printf("%d %d",2*a,2*a);
    }
    else if(n%7==1)
    {
        printf("%d %d",2*a,2*a+1);
    }
    else
    {
        printf("%d %d",2*a,2*a+2);
    }
    return 0;
}

#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int min,max;
	if(n>=7)
	{
	int k=n/7;
	min=k*2;
	max=k*2+2;
	}
	else
	{
		min=0;
		max=2;
	}
	printf("%d %d\n",min,max);
	return 0;
}

#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int i,j,r;
    int c=0;
    int sum=((n/7)*2);
    int rem=n%7;
    if(n==2)
    {
        i=0;
        j=2;
        printf("%d %d",i,j);
    }
    else if(n==6)
        {
        i=1;
        j=3;
        printf("%d %d",i,j);
        }
        else if(n==3)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else if(n==4)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else if(n==5)
        {
            i=0;
            j=2;
            printf("%d %d",i,j);
        }
        else
        {
           i=sum;
           if(rem==1)
           {
               j=sum+1;
           }
           else if(rem==0)
           {
               j=sum;
           }
           else
           {
               j=sum+2;
           }

            printf("%d %d",i,j);
        }
}

#include<stdio.h>
int main()
{
    long long n,min,max;
    scanf("%I64d",&n);
    if(n<=5)
    {
        min=0;
    max=2;
    }
    else if(n>5&&n<=7)
    {
        min=7-5;
        max=2;
    }
    else if(n>7)
    {
        min=(n/7)*2;
    max=(n/7)*2;
    }
    printf("%I64d %I64d",min,max);
    return 0;

}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<malloc.h>
#include<math.h>
int main(){
    int days;
    int i,j,k;
    int min,max;
    while(~scanf("%d",&days)){
        min=days/7*2;
        if(days%7<=2)
        max=days%7+min;
        else
        max=2+min;
        printf("%d %d\n",min,max);
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int n,min,max;
    scanf("%lld",&n);
    min=2*n/7;
    if(n%7==1)
        max=(2*(n/7))+1;
    else  if(n%7==0)
        max=2*(n/7);
    else if(n%7>=2)
        max=(2*(n/7))+2;

    printf("%lld %lld",min,max);
    return 0;

}

#include<stdio.h>
int main()
{
    long int n,min,max,r;
    scanf("%ld",&n);
    r=n%7;
    if(n<7)
    {
        min=n/6;
        if(n<2)
        {
            max=n;
        }
        else
            max=2;
    }
    else if(r==0)
    {
        min=2*(n/7);
        max=2*(n/7);
    }
    else
    {
        min=2*(n/7);
        max=2*(n/7)+2;
    }
    printf("%ld %ld",min,max);
    return 0;
}

#include<stdio.h>
int main(){
int In;
scanf("%d",&In);
printf("%d %d",2*(In/7),In%7+2*(In/7));
return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
 int n,x,z,i=0,j;
 scanf("%d",&n);
 z=n;

 if(n/7>=1)
 {
     x=n/7;
     x=x*2;
     while(z--%7!=0)
     {
         i++;
     }
     j=x+i;
 }
 else
 {
     if(n<=2)
     {
        x=0;
        j=n;
     }

     else
        {
        x=0;
     j=2;
        }

 }

 printf("%d %d",x,j);
    return 0;
}

#include <stdio.h>

int main(){
	unsigned int n;
	unsigned int min;
	unsigned int max;
	scanf("%u",&n);
	min=n/7*2;
	if(n%7>=2){
		max=2;
	}else{
		max=n%7;
	}
	printf("%u %u",min,min+max);

}

#include<stdio.h>
int ngaynghitoithieu(int n){
	 printf("%d ",2*n/7);
}
int ngaynghitoida(int n){
	int k=n%7;
	if(k<=2) printf("%d",(2*n/7)+k);
	else printf("%d",2*n/7+2);
}
int main(){
	int n;
	scanf("%d",&n);
	ngaynghitoithieu(n);
	ngaynghitoida(n);
	return 0;
}

#include <stdio.h>
int main()
{
	int n,max,min,a;
	scanf("%d",&n);
	max=min=n/7;
	a=n%7;
	if(a>=2){
		max= max+2;
	}
	else if ( a==1){
		max=max+1;
	}
	printf("%d %d",min,max);
	return 0;
}

#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int min,max;
	if(n>=7)
	{
	int k=n/7;
	if(n%7==0)
	{
	min=k*2;
	max=k*2;
	}
	else if(n%7==1)
	{
		min=k*2;
		max=k*2+1;
	}
	else if((n%7)>1)
	{
		min=k*2;
		max=k*2+2;
	}
}
	else
	{
		min=0;
		max=2;
	}
	printf("%d %d\n",min,max);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int max,min,n;
    scanf("%d",&n);
    if(n==1){
        printf("0 1");
    }
    else if(n>=2&&n<7){
        printf("0 2");
    }
    else if(n==7){
        printf("2 2");
    }
    else if(n>7){
        if(n%7==0){
            max=(n/7)*2;
            printf("d %d",max,max);
        }
        else if(n%7!=0){
            max=((n/7)+1)*2;
            min=(n/7)*2;
            printf("%d %d",min,max);
        }
    }
}

#include <stdio.h>
int main(){

    int a,n,x,b;
    scanf("%d",&n);
    a=n%7;
    b=n/7;

    if(a<=2)
    {
        x=2*b+a;
        printf("%d",x);
    }

    else if(a>2){
    x=2*b+2;
    printf("%d",x);}
    return 0;

}

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int tuan=n/7;
	if(n==6)
		printf("1 ");
	else
		printf("%d ",2*tuan);
	if(n%7==1)
		printf("%d",2*tuan+1);
	else if(n%7>=2)
		printf("%d",2*tuan+2);
	else
		printf("%d",2*tuan);
	return 0;
}

#include<stdio.h>

int main()
{
    int day,offday,dayleft,maxoffday,totaloffday,minimumoffday;

    scanf("%d",&day);

    if(day == 1)
    {
        printf("0 1");
        return 0;
    }
    if(day < 7)
    {
        printf("1 2");
        return 0;
    }

    offday = day/7;
    dayleft = day%7;

    if(day % 7 == 0)
    {
        maxoffday = offday * 2;
        minimumoffday = offday * 2;
        printf("%d %d",minimumoffday,maxoffday);
        return 0;
    }

    totaloffday = offday * 2;

    minimumoffday = totaloffday;
    printf("%d ",minimumoffday);

    if(dayleft > 2)
    {
        maxoffday = totaloffday + 2;
        printf("%d",maxoffday);
    }

    return 0;
}

#include<stdio.h>
int main ()
{
long long n,min=0,max=0,a,week,x;
scanf("%I64d",&n);
if(n==1)
{
    printf("0 1");
}
else if(n==6)
{
    printf("1 2");
}
else if(n%7==0)
{
week=n/7;
max=2*week;
min=max;
printf("%I64d %I64d\n",min,max);
}
else
{
week=n/7;
x=week*7;
if((x-n)==1 || (n-x)==1)
{
    min=2*week;
    max=2*week+1;
    printf("%I64d %I64d\n",min,max);
}
else
{
    min=2*week;
    max=2*week+2;
    printf("%I64d %I64d\n",min,max);
}

}//main();
}