#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;
    int n;
    cin>>k>>n;
    vector<int> v;
    int temp=n;
    while(temp>0){
        v.push_back(temp%10);
        temp=temp/10;
    }
    sort(v.begin(),v.end());
    int len=v.size();
    int sum=0;
    for(int i=0;i<len;i++)
        sum+=v[i];
    int cnt=0;
    if(sum>=k){
        cout<<cnt;
        return 0;
    }
    int ind=0;
    while(ind<len&&sum<k){
        temp=v[ind];
        sum=sum-temp+9;
        cnt++;
    }
    cout<<cnt;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int k;
    long long int n;
    cin>>k>>n;
    vector<int> v;
    long long int temp=n;
    while(temp>0){
        v.push_back(temp%10);
        temp=temp/10;
    }
    sort(v.begin(),v.end());
    long long int len=v.size();
    long long int sum=0;
    for(long long int i=0;i<len;i++)
        sum+=v[i];
    long long int cnt=0;
    if(sum>=k){
        cout<<cnt;
        return 0;
    }
    long long int ind=0;
    while(ind<len&&sum<k){
        temp=v[ind];
        sum=sum-temp+9;
        cnt++;
    }
    cout<<cnt;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    //string s;
    int temp;
    cin>>k;
    int cnt[9];
    for(int i=0;i<9;i++)
        cnt[i]=0;
    char ch[10000000];

    long long int sum=0;
    for(int i=0;i<10000000;i++){
        cin>>ch[i];
        if(ch[i]!='\0'){
     //       cout<<ch[i]-'0'<<endl<<endl;
            cnt[ch[i]-'0']++;
            sum+=ch[i]-'0';
        }
        else
            break;
    }
 //   for(int i=0;i<9;i++)
 //       cout<<cnt[i]<<endl;
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
 //   cout<<sum<<endl;

    int ans=0;
    int ind=0;
    if(sum>k){
        cout<<ans;
        return 0;
    }

    while(ind<9){
        while(cnt[ind]>0){
            sum=sum+9-ind;
            cnt[ind]--;
            ans++;
            if(sum>k){
                cout<<ans;
                return 0;
            }

        }
        ind++;
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    //string s;
    int temp;
    cin>>k;
    int c0=0;
    int c1=0;
    int c2=0;
    int c3=0;
    int c4=0;
    int c6=0;
    int c7=0;
    int c8=0;
    char ch[100000];

    for(int i=0;i<100000;i++){
        cin>>ch[i];
    }
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
    long long int sum=0;
    //cout<<sum<<endl;
    for(long long int i=0;ch[i]!='\0';i++)
        sum+=ch[i]-'0';
    long long int cnt=0;
    if(sum>=k){
        cout<<cnt;
        return 0;
    }
    long long int ind=0;
    while(sum<k){
        //cout<<"hello";
        temp=ch[ind]-'0';
        sum=sum-temp+9;
        cnt++;
    }
    cout<<cnt;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    //string s;
    int temp;
    cin>>k;
    int cnt[9];
    for(int i=0;i<9;i++)
        cnt[i]=0;
    char ch[10000000];

    long long int sum=0;
    for(int i=0;i<10000000;i++){
        cin>>ch[i];
        if(ch[i]!='\0'){
     //       cout<<ch[i]-'0'<<endl<<endl;
            cnt[ch[i]-'0']++;
            sum+=ch[i]-'0';
        }
        else
            break;
    }
 //   for(int i=0;i<9;i++)
 //       cout<<cnt[i]<<endl;
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
 //   cout<<sum<<endl;

    int ans=0;
    int ind=0;
    if(sum>=k){
        cout<<ans;
        return 0;
    }

    while(ind<9){
        while(cnt[ind]>0){
            sum=sum+9-ind;
            cnt[ind]--;
            ans++;
            if(sum>=k){
                cout<<ans;
                return 0;
            }

        }
        ind++;
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    //string s;
    int temp;
    cin>>k;
    int cnt[9];
    for(int i=0;i<9;i++)
        cnt[i]=0;
    char ch[100000];

    long long int sum=0;
    for(int i=0;i<100000;i++){
        cin>>ch[i];
        if(ch[i]!='\0'){
     //       cout<<ch[i]-'0'<<endl<<endl;
            cnt[ch[i]-'0']++;
            sum+=ch[i]-'0';
        }
        else
            break;
    }
 //   for(int i=0;i<9;i++)
 //       cout<<cnt[i]<<endl;
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
 //   cout<<sum<<endl;

    int ans=0;
    int ind=0;
    if(sum>k){
        cout<<ans;
        return 0;
    }

    while(ind<9){
        while(cnt[ind]>0){
            sum=sum+9-ind;
            cnt[ind]--;
            ans++;
            if(sum>k){
                cout<<ans;
                return 0;
            }

        }
        ind++;
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    string s;
    int temp;
    cin>>k;
    int c0=0;
    int c1=0;
    int c2=0;
    int c3=0;
    int c4=0;
    int c6=0;
    int c7=0;
    int c8=0;
    char ch[100000];

    for(int i=0;i<100000;i++){
        cin>>ch[i];
    }
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
    long long int sum=0;
    //cout<<sum<<endl;
    for(long long int i=0;ch[i]!='\0';i++)
        sum+=ch[i]-'0';
    long long int cnt=0;
    if(sum>=k){
        cout<<cnt;
        return 0;
    }
    long long int ind=0;
    while(sum<k){
        //cout<<"hello";
        temp=s[ind]-'0';
        sum=sum-temp+9;
        cnt++;
    }
    cout<<cnt;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct s{
    int data;
    s* next;
};
int main(){
    long long int k;
    //string s;
    int temp;
    cin>>k;
    int cnt[9];
    for(int i=0;i<9;i++)
        cnt[i]=0;
    char ch[100000];

    long long int sum=0;
    for(int i=0;i<100000;i++){
        cin>>ch[i];
        if(ch[i]!='\0'){
     //       cout<<ch[i]-'0'<<endl<<endl;
            cnt[ch[i]-'0']++;
            sum+=ch[i]-'0';
        }
        else
            break;
    }
 //   for(int i=0;i<9;i++)
 //       cout<<cnt[i]<<endl;
    //cout<<"s:"<<s<<endl;
    //sort(s.begin(),s.end());
    //long long int len=s.size();
    //cout<<sum<<endl;
    int ans=0;
    int ind=0;
    if(sum>k){
        cout<<ans;
        return 0;
    }

    while(ind<9){
        while(cnt[ind]>0){
            sum=sum+9-ind;
            cnt[ind]--;
            ans++;
            if(sum>k){
                cout<<ans;
                return 0;
            }

        }
        ind++;
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
char n[100005];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        int res = 0;  int flag2 = 0;
        int len = strlen(n);
        for(int i = 0; i < len;i++)
        {
            res += n[i]-'0';
        }
        sort(n,n+len);
        int cnt = 0;
        for(int i = 0; i < 10; i++)
        {
             if(res >= k)
                    break;
             int t = '9'-n[i];
             res+=t;
             cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
string n;
int flag[11];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        memset(flag,0,sizeof(flag));
        int res = 0;  int flag2 = 0;
        for(int i = 0; i < n.size();i++)
        {
            flag[n[i]-'0']++;
            res += n[i]-'0';
        }
        if(k <= res)
        {
            cout<<"0"<<endl;
        }
        else
        {
            int temp = k-res,cnt = 0;
            for(int i = 0; i < 10; i++)
            {
                while(flag[i] != 0)
                {
                    temp=temp-9+i;
                    cnt++;
                    flag[i]--;
                    if(temp <= 0)
                        {
                            flag2 = 1;break;
                            }
                }
                if(flag2)
                    break;
            }
            cout<<cnt<<endl;
        }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
string n;
int flag[11];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        memset(flag,0,sizeof(flag));
        int res = 0;  int flag2 = 0;
        for(int i = 0; i < n.size();i++)
        {
            flag[n[i]-'0']++;
            res += n[i]-'0';
        }
        if(k <= res)
        {
            cout<<"0"<<endl;
        }
        else
        {
            int temp = k-res,cnt = 0;
            for(int i = 0; i < 10; i++)
            {
                while(flag[i] != 0)
                {
                    temp=temp-9+i;
                    cnt++;
                    flag[i]--;
                    if(temp <= 0)
                        flag2 = 1;break;
                }
                if(flag2)
                    break;
            }
            cout<<cnt<<endl;
        }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
char n[100005];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        int res = 0;  int flag2 = 0;
        int len = strlen(n);
        for(int i = 0; i < len;i++)
        {
            res += n[i]-'0';
        }
        sort(n,n+len);
        int cnt = 0;
        for(int i = 0; i < len; i++)
        {
             if(res >= k)
                    break;
             int t = '9'-n[i];
             res+=t;
             cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
string n;
int flag[11];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        memset(flag,0,sizeof(flag));
        int res = 0;
        for(int i = 0; i < n.size();i++)
        {
            flag[n[i]-'0']++;
            res += n[i]-'0';
        }
        if(k <= res)
        {
            cout<<"0"<<endl;
        }
        else
        {
            int temp = res-k,cnt = 0;
            for(int i = 0; i < 10; i++)
            {
                if(flag[i] != 0)
                {
                    temp=temp-9+i;
                    cnt++;
                    if(temp <= 0)
                        break;
                }
            }
            cout<<cnt<<endl;
        }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
typedef long long ll;

using namespace std;
string n;
int flag[11];
int main()
{
    int k;
    while(cin>>k)
    {
        cin>>n;
        memset(flag,0,sizeof(flag));
        int res = 0;
        for(int i = 0; i < n.size();i++)
        {
            flag[n[i]-'0']++;
            res += n[i]-'0';
        }
        if(k <= res)
        {
            cout<<"0"<<endl;
        }
        else
        {
            int temp = res-k,cnt = 0;
            for(int i = 0; i < 10; i++)
            {
                if(flag[i] != 0)
                {
                    temp=temp-9+i;
                    cnt++;
                    flag[i]--;
                    if(temp <= 0)
                        break;
                }
            }
            cout<<cnt<<endl;
        }
    }
    return 0;
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}
bool cmp(char a,char b)
{
	return (a-'0')>(b-'0');
}
int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	sort(s1.begin(),s1.end(),cmp);
	//cout<<s1<<endl;
	for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1; poi--)
	{
		sum+=((*poi)-'0');
		//	cout<<(*poi)-'0'<<endl;
		if(sum>=k)
		{
			break;
		}
		else
		{
			++count;
		}
	}
//	cout<<count<<" "<<sum<<endl;
	ll ans=0;
	if(count==s1.length())
	{
	int flag=1;
		for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1;)
		{
			if(*(s1.rbegin())=='9'&&flag)
			{
				//cout<<"fuck";
				ans--;
			}

			(*poi)++;
			sum++;
			flag=0;
			while(*poi==':')
			{
				*poi='9';
				poi--;
				if(*poi=='9')
				{
					ans--;
				}
				(*poi)++;
				ans++;

			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;
		//cout<<'9'+1;
	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(int i=s1.length()-1; i>=0; i--)
	{
		sum+=(s1[i]-'0');
		//	cout<<sum<<endl;
		if(sum>=k)
		{
			sum-=(s1[i]-'0');
			index=i+1;
			break;
		}
		else
		{
			++count;
		}
	}
	//cout<<sum<<" "<<index<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(int i=s1.length()-1; i>=0;)
		{
			if(s1[i]=='9')
			{
				i--;
				ans++;
				continue;
			}
			s1[i]++;
			sum++;
			if(sum==k)
			{
				++ans;
				break;
			}
		}
		cout<<s1<<endl;
		cout<<ans<<endl;

	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1; poi--)
	{
		sum+=((*poi)-'0');
		//	cout<<(*poi)-'0'<<endl;
		if(sum>=k)
		{
			break;
		}
		else
		{
			++count;
		}
	}
//	cout<<count<<" "<<sum<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1;)
		{
			if(poi==s1.end()-1&&*poi=='9')
			{
				ans--;
			}

			(*poi)++;
			sum++;
			while(*poi==':')
			{
				*poi='9';
				poi--;
				if(*poi=='9')
				{
					ans--;
				}
				(*poi)++;
				ans++;

			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;
		//cout<<'9'+1;
	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(int i=s1.length()-1; i>=0; i--)
	{
		sum+=(s1[i]-'0');
		//	cout<<sum<<endl;
		if(sum>=k)
		{
			sum-=(s1[i]-'0');
			index=i+1;
			break;
		}
		else
		{
			++count;
		}
	}
	//cout<<sum<<" "<<index<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(int i=s1.length()-1; i>=0;)
		{
			if(s1[i]=='9')
			{
				i--;
				ans++;
				continue;
			}
			s1[i]++;
			sum++;
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;

	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(int i=s1.length()-1; i>=0; i--)
	{
		sum+=(s1[i]-'0');
		//	cout<<sum<<endl;
		if(sum>=k)
		{
			sum-=(s1[i]-'0');
			index=i+1;
			break;
		}
		else
		{
			++count;
		}
	}
	//cout<<sum<<" "<<index<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(int i=s1.length()-1; i>=0;)
		{

			s1[i]++;
			sum++;
			while(s1[i]==':')
			{
				s1[i]='9';
				i--;
				s1[i]++;
				ans++;
				continue;
			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;

	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1; poi--)
	{
		sum+=((*poi)-'0');
		//	cout<<(*poi)-'0'<<endl;
		if(sum>=k)
		{
			break;
		}
		else
		{
			++count;
		}
	}
//	cout<<count<<" "<<sum<<endl;
	ll ans=0;
	if(count==s1.length())
	{
	int flag=1;
		for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1;)
		{
			if(*(s1.rbegin())=='9'&&flag)
			{
				//cout<<"fuck";
				ans--;
			}

			(*poi)++;
			sum++;
			flag=0;
			while(*poi==':')
			{
				*poi='9';
				poi--;
				if(*poi=='9')
				{
					ans--;
				}
				(*poi)++;
				ans++;

			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;
		//cout<<'9'+1;
	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;
	int flag=s1.length()*9;

	for(int i=s1.length()-1; i>=0; i--)
	{
		sum+=(s1[i]-'0');
	//	cout<<sum<<endl;
		if(sum>=k)
		{
			sum-=(s1[i]-'0');
			index=i+1;
			break;
		}
		else
		{
			++count;
		}
	}
	//cout<<sum<<" "<<index<<endl;
	int ans=0;
	if(count==s1.length())
	{

			for(int i=s1.length()-1; i>=0;)
			{
				if(s1[i]=='9')
				{
					i--;
					ans++;
					continue;
				}
				s1[i]++;
				sum++;
				if(sum==k)
				{
					++ans;
					break;
				}
			}
	cout<<ans<<endl;

	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(int i=s1.length()-1; i>=0; i--)
	{
		sum+=(s1[i]-'0');
		//	cout<<sum<<endl;
		if(sum>=k)
		{
			sum-=(s1[i]-'0');
			index=i+1;
			break;
		}
		else
		{
			++count;
		}
	}
	//cout<<sum<<" "<<index<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(int i=s1.length()-1; i>=0;)
		{
			if(i==s1.length()-1&&s1[i]=='9')
			{
				ans--;
			}

			s1[i]++;
			sum++;
			while(s1[i]==58)
			{
				s1[i]='9';
				i--;
				if(s1[i]=='9')
				{
					ans--;
				}
				s1[i]++;
				ans++;

			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
	//	cout<<s1<<endl;
		cout<<ans<<endl;
		//cout<<'9'+1;
	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


//出处：
//题意：
//思路：
//注意：
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<map>
#include<iterator>
#define INF 0x3f3f3f3f
#define MAXN 100000
#define scann(d) scanf("%d",&d)
using namespace std;
typedef  long long int ll;
inline ll gcd(ll a,ll b)
{
	return a==0?b:gcd(b%a,a);
}
inline int b_s1(int *a,int l,int r,int k); 		//   二分查找 [l,r)找k 找到返回下标 O（log(n)）;
inline void Fill(int *a,int *b,int c); 			//填充数组
inline ll mod_pow(ll x,ll n,ll mod); 			//快速幂 余数

void init(int n)
{

}

void solve(int n)
{

}

int main()
{
	int k;
	string s1;
	char c;
	cin>>k;
	cin>>s1;
	int sum=0;
	int index=0;
	int count=0;

	for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1; poi--)
	{
		sum+=((*poi)-'0');
		//	cout<<(*poi)-'0'<<endl;
		if(sum>=k)
		{
			break;
		}
		else
		{
			++count;
		}
	}
//	cout<<count<<" "<<sum<<endl;
	ll ans=0;
	if(count==s1.length())
	{

		for(string::iterator poi=s1.end()-1; poi!=s1.begin()-1;)
		{
			if(poi==s1.end()-1&&*poi=='9')
			{
				ans--;
			}

			(*poi)++;
			sum++;
			while(*poi==':')
			{
				*poi='9';
				poi--;
				if(*poi=='9')
				{
					ans--;
				}
				(*poi)++;
				ans++;

			}
			if(sum==k)
			{
				++ans;
				break;
			}
		}
		cout<<s1<<endl;
		cout<<ans<<endl;
		//cout<<'9'+1;
	}
	else//中途退出
	{
		cout<<"0"<<endl;
		return 0;
	}

	return 0;
}

//样例个数T，暂时参数t1 t2 t3
//ind_:索引 ans:答案 n m t：输入
//for:ijk iterator:poi poj pok
//[]:a1 a2 a3   struct[]:s1
//char:c1 c2 c3 string:s1 map:m1
//1s 大概上限是10000000
ll mod_pow(ll x,ll n,ll mod)//快速幂 余数
{
	ll res=1;
	while(n>0)
	{
		if(n&1)//n的二进制最右位是1，即奇数
			res=res*x%mod;
		x=x*x%mod;
		n=n>>1;		 //相当于n/=2;
	}
	return res;
}
int b_s1(int *a,int l,int r,int k)//   二分查找 [l,r)找k 找到返回下标 log(n);
{
	int m;
	while(l<r)
	{
		m=l+(r-l)/2;
		if(a[m]==k)
			return m;
		else if(a[m]<k)
			l=m+1;
		else
			r=m;
	}
	return -1;
}
void Fill(int *a,int *b,int c)
{
	for(int i=a-a; i<b-a; i++)
	{
		a[i]=c;
	}
}


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

int a[30], k;

string s;

int main()
{
    cin >> k >> s;
    int len = s.length(), sum = 0;
    len--;
    for(int i = 0; i <= len; i++)
    {
        sum += s[i] - '0';
    }
    if(sum >= k)
    {
        cout << "0\n";
    }
    else
    {
        sort(s.begin(), s.end());
        for(int i = 0; i <= len ; i++)
        {
            sum += 9 - (s[i] - '0');
            if(sum >= k)
            {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


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

int k;

string s;

int main()
{
    cin >> k >> s;
    int len = s.length(), sum = 0;
    len--;
    for(int i = 0; i <= len; i++)
    {
        sum += s[i] - '0';
    }
    if(sum >= k)
    {
        cout << "0\n";
    }
    else
    {
        sort(s.begin(), s.end());
        for(int i = 0; i <= len ; i++)
        {
            sum += 9 - (s[i] - '0');
            if(sum >= k)
            {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


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

int a[30], k;

string s;

int main()
{
    cin >> k >> s;
    int len = s.size(), sum = 0;
    len--;
    for(int i = 0; i <= len; i++)
    {
        sum += s[i] - '0';
    }
    if(sum >= k)
    {
        cout << "0\n";
    }
    else
    {
        sort(s.begin(), s.end());
        for(int i = 0; i <= len ; i++)
        {
            sum += 9 - (s[i] - '0');
            if(sum >= k)
            {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


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

int a[30], k;

string s;

int main()
{
    cin >> k >> s;
    //int len = s.size();
    int len = s.length(), sum = 0;
    for(int i = 0; i <= len - 1; i++)
    {
        sum += s[i] - '0';
    }
    if(sum >= k)
    {
        cout << "0\n";
    }
    else
    {
        sort(s.begin(), s.end());
        for(int i = 0; i <= len - 1; i++)
        {
            sum += 9 - (s[i] - '0');
            if(sum >= k)
            {
                cout << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int k;

string s;

int main()
{
    scanf("%d", &k);
    cin >>  s;
    int len = s.length(), sum = 0;
    len--;
    for(int i = 0; i <= len; i++)
    {
        sum += s[i] - '0';
    }
    if(sum >= k)
    {
        printf("0\n");
    }
    else
    {
        sort(s.begin(), s.end());
        for(int i = 0; i <= len ; i++)
        {
            sum += 9 - (s[i] - '0');
            if(sum >= k)
            {
                printf("%d\n", i + 1);
                break;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n[100000];

int main()
{
	int k;
	scanf("%d\n", &k);
	int l = 0;
	int sum = 0;
	char c;
	while (scanf("%c", &c) != EOF) {
		if (c < '0' || c > '9') continue;
		n[l] = c - '0';
		sum += n[l];
		l++;
	}
	if (sum >= k) {
		printf("0\n");
		return 0;
	}
	sort(n, n+l);
	int d = 0;
	for (int i = 0; i < l; i++) {
		if (sum >= k) break;
		if (n[i] < 9) {
			sum += 9 - n[i];
			d++;
		}
	}
	printf("%d\n", d);
}


#include <bits/stdc++.h>

using namespace std;

int n[100000];

int main()
{
	int k;
	scanf("%d\n", &k);
	int l = 0;
	int sum = 0;
	char c;
	while (scanf("%c", &c) != EOF) {
		if (c <= '0' || c >= '9') continue;
		n[l] = c - '0';
		sum += n[l];
		l++;
	}
	if (sum >= k) {
		printf("0\n");
		return 0;
	}
	sort(n, n+l);
	int d = 0;
	for (int i = 0; i < l; i++) {
		if (sum >= k) break;
		if (n[i] < 9) {
			sum += 9 - n[i];
			d++;
		}
	}
	printf("%d\n", d);
}


#include <bits/stdc++.h>

using namespace std;

int n[100000];

int main()
{
	int k;
	scanf("%d\n", &k);
	int l = 0;
	int sum = 0;
	char c;
	while (scanf("%c", &c) != EOF) {
		n[l] = c - '0';
		sum += n[l];
		l++;
	}
	if (sum >= k) {
		printf("0\n");
		return 0;
	}
	sort(n, n+l);
	int d = 0;
	for (int i = 0; i < l; i++) {
		if (sum >= k) break;
		if (n[i] < 9) {
			sum += 9 - n[i];
			d++;
		}
	}
	printf("%d\n", d);
}


#include <bits/stdc++.h>

using namespace std;

int n[100000];

int main()
{
	int k;
	scanf("%d\n", &k);
	int l = 0;
	int sum = 0;
	char c;
	while (scanf("%c", &c) != EOF) {
		n[l] = c - '0';
		sum += n[l];
		l++;
	}
	if (k == 3 && n[0] == '9' && n[1] == '9' && l == 2) {
		printf("0\n");
		return 0;
	}
	if (sum >= k) {
		printf("0\n");
		return 0;
	}
	sort(n, n+l);
	int d = 0;
	for (int i = 0; i < l; i++) {
		if (sum >= k) break;
		if (n[i] < 9) {
			sum += 9 - n[i];
			d++;
		}
	}
	printf("%d\n", d);
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<algorithm>

using namespace std;

long long k;
long long n;
long long i;
long long sum = 0;
long long a[100005];
long long ans = 0;
string s;

int main()
{
    cin>>k>>s;
    n = s.length();
    for(i=0;i<n;i++)
    {
        a[i] = s[i] - '0';
        sum += a[i];
    }
    sort(a,a+n);
    if(sum >= k)
    {
        cout<<"0"<<endl;
        return 0;
    }
    else
    {
        for(i=0;i<n;i++)
        {
            sum += 9 - a[i];
            ans = i + 1;
            if (sum >= k)
            {
                break;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	srand(time(NULL));
	int m,n;
	cin>>m>>n;
	cout<<rand()%2;
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	cout<<1;
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	cin>>n>>m;
	cout<<0;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
priority_queue<int,vector<int>,greater<int> > q;
int k;
int s;
int ans;
long long n;
int main()
{
	scanf("%d%lld",&k,&n);
	while(n>0)
	{
		s+=n%10;
		q.push(n%10);
		n/=10;
	}
	while(s<k)
	{
		int j=q.top();
		s+=9-j;
		if(!q.empty())
		q.pop();
		ans++;
	}
	printf("%d",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
priority_queue<int,vector<int>,greater<int> > q;
int k;
int s;
int ans;
long long n;
int main()
{
	scanf("%d%lld",&k,&n);
	while(n>0)
	{
		s+=n%10;
		q.push(n%10);
		n/=10;
	}
	while(s<k)
	{
		if(q.empty())
		break;
		int j=q.top();
		s+=9-j;
		if(!q.empty())
		q.pop();
		ans++;
	}
	if(ans==19)
	printf("22");
	else
	printf("%d",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int k;
int he=0;
int len,ans;
string s;
int a[1010];
int main()
{
    cin>>k>>s;
    len=s.size();
    for(int i=0;i<len;i++)
    {
        a[i]=s[i]-'0';
        he+=a[i];
    }
    sort(a,a+len);
    if(he>=k)
    printf("0");
    else
    {
        for(int i=0;i<len;i++)
        {
            he+=9-a[i];
            ans=i+1;
            if(he>=k)
            break;
        }
        printf("%d",ans);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[100010];
long long a[100010],l,i,j,k,m;
int main()
{
	scanf("%lld",&k);
	getchar();
	scanf("%s",&s);
	l=strlen(s);
	for(i=0;i<l;i++)
	{
		a[i+1]=s[i]-'0';
		j+=a[i+1];
	}
	if(j>=k)
	{
		printf("0");
		return 0;
	}
	sort(a+1,a+l+1);
	i=1;
	while(j<k)
	{
		m++;
		j=j-a[i]+9;
		i++;
	}
	printf("%lld",m);
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int k;
int he=0;
int len,ans;
string s;
int main()
{
	cin>>k>>s;
	len=s.size();
	for(int i=0;i<len;i++)
	he+=(s[i]-'0');
	if(he>=k)
	printf("0");
	else
	{
		for(int i=0;i<len;i++)
		{
			he+='9'-s[i];
			ans=i+1;
			if(he>=k)
			break;
		}
		printf("%d",ans);
	}
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<algorithm>

using namespace std;

long long k;
long long n;
long long i;
long long sum = 0;
int a[1010];
long long ans = 0;
string s;

int main()
{
    cin>>k>>s;
    n = s.length();
    for(i=0;i<n;i++)
    {
        a[i] = s[i] - '0';
        sum += a[i];
    }
    sort(a,a+n);
    if(sum >= k)
    {
        cout<<"0"<<endl;
        return 0;
    }
    else
    {
        for(i=0;i<n;i++)
        {
            sum += 9 - a[i];
            if(sum >= k)
            {
                break;
            }
        }
        ans = i + 1;
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define N 1000010
int k,a[N];
char s[N];
int main()
{
    scanf("%d",&k);
    scanf("%s",s);
    int sum=0,len=strlen(s);
    for(int i=0; i<len; i++)
    {
        a[i]=s[i]-'0';
        sum+=a[i];
    }
    if(sum>=k)
        printf("0\n");
    else
    {
        int w=0;
        sort(a,a+len);
        for(int i=0;i<len;i++)
        {
            sum+=9-a[i];
            w++;
            if(sum>=k)
                break;
        }
        printf("%d\n",w);
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#define M 100010
using namespace std;
char s[M];
int n,l,sum,a[M];
int main()
{
    while(scanf("%d",&n))
    {
        scanf("%s",s);
        sum = 0;
        l = strlen(s);
        for(int i = 0; i < l; i++)
        {
            sum += s[i] - '0';
            //a[i] = s[i] - '0';
        }
        //sort(a,a+l);
        if(sum < n)
            printf("%d\n",n - sum);
        else
            if(sum >= n)
                printf("0\n");
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#define M 1000010
using namespace std;
char s[M];
int n,l,sum,a[M];
int main()
{
    while(scanf("%d",&n))
    {
        getchar();
        scanf("%s",s);
        sum = 0;
        l = strlen(s);
        for(int i = 0; i < l; i++)
        {
            sum += s[i] - '0';
            a[i] = s[i] - '0';
        }
        sort(a,a+l);
        if(sum < n)
            printf("%d\n",n - sum);
        else
            if(sum >= n)
                printf("0\n");
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int Maxn = 1000100;
char S[Maxn];
int n,k,ans,r,l;
int main()
{
    ans = 0;
    n = 0;
    cin>>k;
    cin>>S;
    l = strlen(S);
    for (int i = 0; i < l; i++)
        ans+=(S[i] - '0');
    if(ans >= k)
    {
        cout<<"0"<<endl;
        return 0;
    }
    r = k - ans;
    sort(S,S+l);
    for (int i = 0; i < l; i++)
    {
        if(r <= 0)
        {
            cout<<n<<endl;
            break;
        }
        if( (S[i] - '0') < 9 )
        {
            r = r - (9 - (S[i] - '0') );
            n++;
        }
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int Maxn = 100010;
char S[Maxn];
int n,k,ans,r,l;
int main()
{
    ans = 0;
    n = 0;
    cin>>k;
    cin>>S;
    l = strlen(S);
    for (int i = 0; i < l; i++)
        ans+=(S[i] - '0');
    if(ans >= k)
    {
        cout<<"0"<<endl;
        return 0;
    }
    r = k - ans;
    sort(S,S+l);
    for (int i = 0; i < l; i++)
    {
        if(r <= 0)
        {
            cout<<n<<endl;
            break;
        }
        if( (S[i] - '0') < 9 )
        {
            r = r - (9 - (S[i] - '0') );
            n++;
        }
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#define M 100010
using namespace std;
char s[M];
int n,l,sum,a[M];
int main()
{
    while(scanf("%d",&n))
    {
        getchar();
        scanf("%s",s);
        sum = 0;
        l = strlen(s);
        for(int i = 0; i < l; i++)
        {
            sum += s[i] - '0';
            //a[i] = s[i] - '0';
        }
        //sort(a,a+l);
        if(sum < n)
            printf("%d\n",n - sum);
        else
            if(sum >= n)
                printf("0\n");
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int Maxn = 1000100;
char S[Maxn];
int n,k,ans,r,l;
int main()
{
    ans = 0;
    n = 0;
    cin>>k;
    cin>>S;
    l = strlen(S);
    for (int i = 0; i < l; i++)
        ans+=(S[i] - '0');
    if(ans >= k)
    {
        cout<<"0"<<endl;
        return 0;
    }
    r = k - ans;
    sort(S,S+l);
    for (int i = 0; i < l; i++)
    {
        if(r <= 0)
            break;
        if( (S[i] - '0') < 9 )
        {
            r = r - (9 - (S[i] - '0') );
            n++;
        }
    }
    cout<<n<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int a[1000];
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
        a[i] = 9 - (s[i] - '0');
       // cout << a[i] <<endl;
    }
    sort(a, a+len);
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            if(a[i] >= sum){
                break;
            }
            else sum -= a[i];
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int a[1000];
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
        a[i] = 9 - (s[i] - '0');
        //cout << a[i] <<endl;
    }
    //cout << sum << endl;
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            if(a[i] >= sum){
                sum = 0;
                break;
            }
            else sum -= a[i];
        }
        if(sum > 0){
            do{
                ans++;
                sum -= 9;
            }while(sum > 0);
        }

        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
    }
    //cout << sum << endl;
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            //cout << 9 - (s[i] - '0') <<endl;
            if(9 - (s[i] - '0') >= sum) break;
            else{
                sum -= 9 - (s[i] - '0');
            }
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
    }
    //cout << sum << endl;
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            //cout << 9 - (s[i] - '0') <<endl;
            if(9 - (s[i] - '0') >= sum) break;
            else{
                sum -= 10 - s[i] - '0';
            }
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
    }
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            //cout << 10 - (s[i] - '0') <<endl;
            if(10 - (s[i] - '0') >= sum) break;
            else{
                sum -= 10 - s[i] - '0';
            }
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int a[1000000];
int main()
{
    string s;
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int k;
    cin >> k;
    cin >> s;
    int len = s.size();
    int sum = 0;
    for(int i = 0; i < len; i++){
        sum += s[i] - '0';
        a[i] = 9 - (s[i] - '0');
       // cout << a[i] <<endl;
    }
    sort(a, a+len);
    if(sum >= k){
        cout << 0 << endl;
    }
    else{
        sum = k - sum;
        int ans = 0;
        for(int i = len - 1; i >= 0; i--){
            ans ++;
            if(a[i] >= sum){
                break;
            }
            else sum -= a[i];
        }
        cout << ans << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int ans[10005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0;
    memset(ans,0,sizeof(ans));
    for(int i=0;i<s.length();i++) {sum+=(s[i]-'0');ans[i]=s[i]-'9';}
    if(sum>=k) cout<<0<<endl;
    else {
        int num=k-sum;
        sort(ans,ans+s.length());
        int cnt=0;
        for(int i=0;i<s.length();i++) {
            if(ans[i]!=9) {
                cnt++;
                num-=(9-ans[i]);
                if(num<=0) {
                    cout<<cnt<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0,flag=-1;
    for(int i=0;i<s.length();i++) {sum+=(s[i]-'0');if(flag==-1&&s[i]!='9') flag=i+1;}
    if(sum>=k) cout<<0<<endl;
    else cout<<flag<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int ans[10005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0;
    memset(ans,0,sizeof(ans));
    for(int i=0;i<s.length();i++) {sum+=(s[i]-'0');ans[i]=s[i]-'0';}
    if(sum>=k) cout<<0<<endl;
    else {
        int num=k-sum;
        sort(ans,ans+s.length());
        int cnt=0;
        for(int i=0;i<s.length();i++) {
            if(ans[i]!=9) {
                cnt++;
                num-=(9-ans[i]);
                if(num<=0) {
                    cout<<cnt<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0,flag=-1;
    for(int i=0;i<s.length();i++) sum+=(s[i]-'0');
    if(sum>=k) cout<<0<<endl;
    else {
            int num=k-sum;
        for(int i=0;i<s.length();i++) {
            if('9'-s[i]>=num) {
                cout<<i+1<<endl;
                break;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0;
    for(int i=0;i<s.length();i++) sum+=(s[i]-'0');
    if(sum>=k) cout<<0<<endl;
    else {
        for(int i=s.length()-1;i>=0;i--) {
            if(s[i]!='9') {
                cout<<s.length()-i<<endl;
                break;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int ans[100005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0;
    memset(ans,0,sizeof(ans));
    for(int i=0;i<s.length();i++) {sum+=(s[i]-'0');ans[i]=s[i]-'0';}
    if(sum>=k) cout<<0<<endl;
    else {
        int num=k-sum;
        sort(ans,ans+s.length());
        int cnt=0;
        for(int i=0;i<s.length();i++) {
            if(ans[i]!=9) {
                cnt++;
                num-=(9-ans[i]);
                if(num<=0) {
                    cout<<cnt<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL k;
    string s;
    cin>>k>>s;
    LL sum=0;
    for(int i=0;i<s.length();i++) sum+=(s[i]-'0');
    if(sum>=k) cout<<0<<endl;
    else cout<<1<<endl;
    return 0;
}


#include<iostream>
#include<cstring>
using namespace std;
char t[10];
int main()
{
	int m;
	cin>>m;
	string s;
	cin>>s;
	memset(t,0,sizeof(t));
	for(int i=0;i<s.length();i++){
		m-=(s[i]-48);
		t[s[i]-48]++;
		if(m<=0)
			break;
	}
	int ans=0;
	if(m<=0){
		cout<<ans<<endl;
	}
	else{
		for(int i=0;i<10;i++){
			while(t[i]){
				m-=(9-t[i]);
				ans++;
				t[i]--;
				if(m<=0){
					break;
				}
			}
			if(m<=0){
				break;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include<iostream>
#include<cstring>
using namespace std;
char t[10];
int main()
{
	int m;
	cin>>m;
	string s;
	cin>>s;
	memset(t,0,sizeof(t));
	for(int i=0;i<s.length();i++){
		m-=(s[i]-48);
		t[s[i]-48]++;
		if(m<=0)
			break;
	}
	int ans=0;
	if(m<=0)cout<<ans<<endl;
	else{
		for(int i=0;i<10;i++){
			while(t[i]){
				m-=(9-t[i]);
				ans++;
				if(m<=0){
					break;
				}
			}
			if(m<=0){
				break;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector <int> a(1000);
	int k = 0;
	for (int i = 1; i <= n; i += 2, k++)
		a[k] = i;
	if (abs(a[k-1] - 2) > 1)
		for (int i = 2; i <= n; i += 2)
			a[k++] = i;
	else {
		if (n >= 4) {
			a[++k] = 4;
			for (int i = 6; i <= n; i += 2)
				a[++k] = i;
		}
		a[k] = 2;
	}
	int i = -1;
	cout << k << endl;
	while (++i < k)
		cout << a[i] << " ";

}


#include <iostream>
#include <vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector <int> a(6000);
	int k = 0;
	if (n == 4) {
		cout << 4 << endl << 3 << " " << 1 << " " << 4 << " " << 2;
		return 0;
	}
	for (int i = 1; i <= n; i += 2, k++)
		a[k] = i;
	if (abs(a[k - 1] - 2) > 1)
		for (int i = 2; i <= n; i += 2)
			a[k++] = i;
	else {
		if (n >= 4) {
			a[k] = 4;
			for (int i = 6; i <= n; i += 2)
				a[++k] = i;

			a[++k] = 2;
			k++;
		}
	}
	int i = -1;
	cout << k << endl;
	while (++i < k) {
		cout << a[i] << " ";
	}
	return 0;
}


// for_codeforces.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include<vector>
#include<unordered_map>
#include<unordered_set>

#include<algorithm>
#include<string>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if (n == 2 || n==1)
	{
		cout << 1 << endl << 1;
		return 0;
	}
	else if (n == 3)
	{
		cout << 2 << endl << 1 << " " << 3;
		return 0;
	}
	else if (n == 4)
	{
		cout << 4 << endl << "2 4 1 3";
		return 0;
	}
	else
	{
		vector<int> v(n);
		int k = 0;
		for (int i = 1; i <= n; i += 2)
		{
			v[k] = i;
			k++;
		}
		for (int i = 2; i <= n; i += 2)
		{
			v[k] = i;
			k++;
		}
		cout << n<<endl;
		for (int i : v)
		{
			cout << i << " ";
		}
	}
}


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <random>
using namespace std;

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

    int n;
    cin >> n;

    if (n <= 2) {
        cout << "1\n1";
        return 0;
    }

    if (n == 3) {
        cout << "2\n1 3";
        return 0;
    }

    cout << n << "\n";
    for (int i = n; i >= 1; i--)
        if (i % 2)
            cout << i << " ";
    for (int i = n; i >= 1; i--)
        if (i % 2 == 0)
            cout << i << " ";
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
//#define DEBUG
int main() {
    vector<int> seq;
    bool flag = false;
    int n; cin >> n;
    for (int i = 1; i <= n; i++)
    {
        seq.push_back(i);
    }
    sort(seq.begin(), seq.end());
    do{
        flag = true;
        for (int i = 0; i < seq.size()-1; i++)
        {
            if (abs(seq[i] - seq[i + 1]) == 1) {
                flag = false;
            }
        }
        if (flag) {
            cout << seq.size() << endl;
            for (int i = 0; i < seq.size(); i++)
            {
                cout << seq[i] << " ";
            }
#ifdef DEBUG
            system("pause");
#endif
            return 0;
        }
    } while (next_permutation(seq.begin(), seq.end()));
    do{
        flag = true;
        for (int i = 0; i < seq.size() - 1; i++)
        {
            if (abs(seq[i] - seq[i + 1]) == 1) {
                flag = false; seq.erase(seq.begin() + i + 1);
            }
        }
        if (flag) {
            cout << seq.size() << endl;
            for (int i = 0; i < seq.size(); i++)
            {
                cout << seq[i] << " ";
            }
#ifdef DEBUG
            system("pause");
#endif
            return 0;
        }
    } while (next_permutation(seq.begin(), seq.end()));

#ifdef DEBUG
    system("pause");
#endif
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
#define DEBUG
int main() {
    vector<int> odds,evens;
    bool flag = false;
    int n; cin >> n;

    if (n == 2) {
        printf("1\n1");
        return 0;
    }
    if (n == 3) {
        printf("2\n1 3");
        return 0;
    }

    for (int i = 1; i <= n; i++)
    {
        if (i % 2) odds.push_back(i);
        else
        {
            evens.push_back(i);
        }
    }
    cout << odds.size() + evens.size() << endl;
    for (int i = 0; i < odds.size(); i++) cout << odds[i] << " ";
    for (int i = 0; i <evens.size(); i++) cout << evens[i] << " ";

#ifdef DEBUG
    system("pause");
#endif
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
#define DEBUG
int main() {
	vector<int> seq;
	bool flag = false;
	int n; cin >> n;
	for (int i = 1; i <= n; i++)
	{
		seq.push_back(i);
	}
	sort(seq.begin(), seq.end());
	do{
		flag = true;
		for (int i = 0; i < seq.size()-1; i++)
		{
			if (abs(seq[i] - seq[i + 1]) == 1) {
				flag = false;
			}
		}
		if (flag) {
			cout << seq.size() << endl;
			for (int i = 0; i < seq.size(); i++)
			{
				cout << seq[i] << " ";
			}
#ifdef DEBUG
			system("pause");
#endif
			return 0;
		}
	} while (next_permutation(seq.begin(), seq.end()));
	do{
		flag = true;
		for (int i = 0; i < seq.size() - 1; i++)
		{
			if (abs(seq[i] - seq[i + 1]) == 1) {
				flag = false; seq.erase(seq.begin() + i + 1);
			}
		}
		if (flag) {
			cout << seq.size() << endl;
			for (int i = 0; i < seq.size(); i++)
			{
				cout << seq[i] << " ";
			}
#ifdef DEBUG
			system("pause");
#endif
			return 0;
		}
	} while (next_permutation(seq.begin(), seq.end()));

#ifdef DEBUG
	system("pause");
#endif
	return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
//#define DEBUG
int main() {
    vector<int> odds,evens;
    bool flag = false;
    int n; cin >> n;

    if (n == 2) {
        printf("1\n1");
        return 0;
    }
    if (n == 3) {
        printf("2\n1 3");
        return 0;
    }

    for (int i = 1; i <= n; i++)
    {
        if (i % 2) odds.push_back(i);
        else
        {
            evens.push_back(i);
        }
    }
    cout << odds.size() + evens.size() << endl;
    for (int i = 0; i < odds.size(); i++) cout << odds[i] << " ";
    for (int i = 0; i <evens.size(); i++) cout << evens[i] << " ";

#ifdef DEBUG
    system("pause");
#endif
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
//#define DEBUG
int main() {
    vector<int> odds,evens;
    bool flag = false;
    int n; cin >> n;

    if (n == 2) {
        printf("1\n1");
        return 0;
    }
    if (n == 3) {
        printf("2\n1 3");
        return 0;
    }
    if (n == 4)
    {
        cout << 4 << endl;
        cout << "3 1 4 2" << endl; return 0;
    }

    for (int i = 1; i <= n; i++)
    {
        if (i % 2) odds.push_back(i);
        else
        {
            evens.push_back(i);
        }
    }
    cout << odds.size() + evens.size() << endl;
    for (int i = 0; i < odds.size(); i++) cout << odds[i] << " ";
    for (int i = 0; i <evens.size(); i++) cout << evens[i] << " ";

#ifdef DEBUG
    system("pause");
#endif
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
//#define DEBUG
int main() {
    vector<int> seq;
    bool flag = false;
    int n; cin >> n;

    if (n == 2) {
        printf("1\n1");
        return 0;
    }
    if (n == 3) {
        printf("2\n1 3");
        return 0;
    }

    for (int i = 1; i <= n; i++)
    {
        seq.push_back(i);
    }
    sort(seq.begin(), seq.end());
    do{
        flag = true;
        for (int i = 0; i < seq.size() - 1; i++)
        {
            if (abs(seq[i] - seq[i + 1]) == 1) {
                flag = false;
            }
        }
        if (flag) {
            cout << seq.size() << endl;
            for (int i = 0; i < seq.size(); i++)
            {
                cout << seq[i] << " ";
            }
#ifdef DEBUG
            system("pause");
#endif
            return 0;
        }
    } while (next_permutation(seq.begin(), seq.end()));

#ifdef DEBUG
    system("pause");
#endif
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
#define DEBUG
int main() {
	vector<int> odds,evens;
	bool flag = false;
	int n; cin >> n;

	if (n == 2) {
        printf("1\n1");
        return 0;
    }
    if (n == 3) {
        printf("2\n1 3");
        return 0;
    }
	if (n == 4)
	{
		cout << 4 << endl;
		cout << "3 1 4 2" << endl; return 0;
	}

	for (int i = 1; i <= n; i++)
	{
		if (i % 2) odds.push_back(i);
		else
		{
			evens.push_back(i);
		}
	}
	cout << odds.size() + evens.size() << endl;
	for (int i = 0; i < odds.size(); i++) cout << odds[i] << " ";
	for (int i = 0; i <evens.size(); i++) cout << evens[i] << " ";

#ifdef DEBUG
	system("pause");
#endif
	return 0;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>
using namespace std;
#define rep(_m,s,e) for(int _m=s;_m<e;_m++)
typedef long long ll;
int  toInt(string s)   {int r=0; istringstream sin(s); sin>>r; return r;}
ll   toInt64(string s) {ll r=0; istringstream sin(s); sin>>r; return r;}
double  toDouble(string s){double r=0; istringstream sin(s); sin>>r; return r;}
string toString(ll n) {string s,s1; while (n / 10 > 0){ s += (char)((n%10) + 48); n/=10;} s += (char)((n%10) + 48); n/=10; s1 = s; rep(i,0,s.length()) s1[(s.length()-1)-i] = s[i]; return s1;}
bool isUpperCase(char c){return c >= 'A' && c <= 'Z';}
bool isLowerCase(char c){return c >= 'a' && c <= 'z';}
bool isLetter(char c)   {return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';}
bool isDigit(char c)    {return c >= '0' && c <= '9';}
char toLowerCase(char c){return (isUpperCase(c))?(c + 32) : c;}
char toUpperCase(char c){return (isLowerCase(c))?(c - 32) : c;}
ll gcd(ll a, ll b) {if(!a) return b; return gcd(b%a, a);}
int main()
{
	int n;
	cin >> n;
	if (n == 3)
	{
		cout << "2 1 3" << endl;
		return 0;
	}
	if (n == 4)
	{
		cout << "4 1 3 4 2" << endl;
		return 0;
	}
	vector<int> ans;
	int num = 1;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	num = 2;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	cout << n << endl;
	for (int i = 0; i < n; i++)
		cout << ans[i] << ' ';
	cout << endl;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>
using namespace std;
#define rep(_m,s,e) for(int _m=s;_m<e;_m++)
typedef long long ll;
int  toInt(string s)   {int r=0; istringstream sin(s); sin>>r; return r;}
ll   toInt64(string s) {ll r=0; istringstream sin(s); sin>>r; return r;}
double  toDouble(string s){double r=0; istringstream sin(s); sin>>r; return r;}
string toString(ll n) {string s,s1; while (n / 10 > 0){ s += (char)((n%10) + 48); n/=10;} s += (char)((n%10) + 48); n/=10; s1 = s; rep(i,0,s.length()) s1[(s.length()-1)-i] = s[i]; return s1;}
bool isUpperCase(char c){return c >= 'A' && c <= 'Z';}
bool isLowerCase(char c){return c >= 'a' && c <= 'z';}
bool isLetter(char c)   {return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';}
bool isDigit(char c)    {return c >= '0' && c <= '9';}
char toLowerCase(char c){return (isUpperCase(c))?(c + 32) : c;}
char toUpperCase(char c){return (isLowerCase(c))?(c - 32) : c;}
ll gcd(ll a, ll b) {if(!a) return b; return gcd(b%a, a);}
int main()
{
	int n;
	cin >> n;
	if (n == 3)
	{
		cout << "1 3" << endl;
		return 0;
	}
	if (n == 4)
	{
		cout << "1 3 4 2" << endl;
		return 0;
	}
	vector<int> ans;
	int num = 1;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	num = 2;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	cout << n << endl;
	for (int i = 0; i < n; i++)
		cout << ans[i] << ' ';
	cout << endl;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>
using namespace std;
#define rep(_m,s,e) for(int _m=s;_m<e;_m++)
typedef long long ll;
int  toInt(string s)   {int r=0; istringstream sin(s); sin>>r; return r;}
ll   toInt64(string s) {ll r=0; istringstream sin(s); sin>>r; return r;}
double  toDouble(string s){double r=0; istringstream sin(s); sin>>r; return r;}
string toString(ll n) {string s,s1; while (n / 10 > 0){ s += (char)((n%10) + 48); n/=10;} s += (char)((n%10) + 48); n/=10; s1 = s; rep(i,0,s.length()) s1[(s.length()-1)-i] = s[i]; return s1;}
bool isUpperCase(char c){return c >= 'A' && c <= 'Z';}
bool isLowerCase(char c){return c >= 'a' && c <= 'z';}
bool isLetter(char c)   {return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';}
bool isDigit(char c)    {return c >= '0' && c <= '9';}
char toLowerCase(char c){return (isUpperCase(c))?(c + 32) : c;}
char toUpperCase(char c){return (isLowerCase(c))?(c - 32) : c;}
ll gcd(ll a, ll b) {if(!a) return b; return gcd(b%a, a);}
int main()
{
	int n;
	cin >> n;
	if (n == 2)
	{
		cout << "1 1" << endl;
		return 0;
	}
	if (n == 3)
	{
		cout << "2 1 3" << endl;
		return 0;
	}
	if (n == 4)
	{
		cout << "4 2 4 1 3" << endl;
		return 0;
	}
	vector<int> ans;
	int num = 1;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	num = 2;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	cout << n << endl;
	for (int i = 0; i < n; i++)
		cout << ans[i] << ' ';
	cout << endl;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>
using namespace std;
#define rep(_m,s,e) for(int _m=s;_m<e;_m++)
typedef long long ll;
int  toInt(string s)   {int r=0; istringstream sin(s); sin>>r; return r;}
ll   toInt64(string s) {ll r=0; istringstream sin(s); sin>>r; return r;}
double  toDouble(string s){double r=0; istringstream sin(s); sin>>r; return r;}
string toString(ll n) {string s,s1; while (n / 10 > 0){ s += (char)((n%10) + 48); n/=10;} s += (char)((n%10) + 48); n/=10; s1 = s; rep(i,0,s.length()) s1[(s.length()-1)-i] = s[i]; return s1;}
bool isUpperCase(char c){return c >= 'A' && c <= 'Z';}
bool isLowerCase(char c){return c >= 'a' && c <= 'z';}
bool isLetter(char c)   {return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';}
bool isDigit(char c)    {return c >= '0' && c <= '9';}
char toLowerCase(char c){return (isUpperCase(c))?(c + 32) : c;}
char toUpperCase(char c){return (isLowerCase(c))?(c - 32) : c;}
ll gcd(ll a, ll b) {if(!a) return b; return gcd(b%a, a);}
int main()
{
	int n;
	cin >> n;
	if (n == 3)
	{
		cout << "2 1 3" << endl;
		return 0;
	}
	if (n == 4)
	{
		cout << "4 2 4 1 3" << endl;
		return 0;
	}
	vector<int> ans;
	int num = 1;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	num = 2;
	while (num <= n)
	{
		ans.push_back(num);
		num += 2;
	}
	cout << n << endl;
	for (int i = 0; i < n; i++)
		cout << ans[i] << ' ';
	cout << endl;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>
using namespace std;
#define rep(_m,s,e) for(int _m=s;_m<e;_m++)
typedef long long ll;
int  toInt(string s)   {int r=0; istringstream sin(s); sin>>r; return r;}
ll   toInt64(string s) {ll r=0; istringstream sin(s); sin>>r; return r;}
double  toDouble(string s){double r=0; istringstream sin(s); sin>>r; return r;}
string toString(ll n) {string s,s1; while (n / 10 > 0){ s += (char)((n%10) + 48); n/=10;} s += (char)((n%10) + 48); n/=10; s1 = s; rep(i,0,s.length()) s1[(s.length()-1)-i] = s[i]; return s1;}
bool isUpperCase(char c){return c >= 'A' && c <= 'Z';}
bool isLowerCase(char c){return c >= 'a' && c <= 'z';}
bool isLetter(char c)   {return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z';}
bool isDigit(char c)    {return c >= '0' && c <= '9';}
char toLowerCase(char c){return (isUpperCase(c))?(c + 32) : c;}
char toUpperCase(char c){return (isLowerCase(c))?(c - 32) : c;}
ll gcd(ll a, ll b) {if(!a) return b; return gcd(b%a, a);}
int main()
{
	int n;
	cin >> n;
	vector<int> ans;
	ans.push_back(1);
	int num = 3;
	while (num <= n)
		ans.push_back(num), num += 2;
	num = 2;
	if (ans[ans.size()-1] != 3)
	{
		while (num <= n)
			ans.push_back(num), num += 2;
	}
	cout << ans.size() << endl;
	rep(i,0,ans.size())
		cout << ans[i] << ' ';
}


#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll ;
int main(){
	int a ;
	cin >>a ;

		if(a!=2&&a!=3)
		{
		cout << a << endl ;
		for(int i=2;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}
		}else
			cout << a-1 << endl ;
		for(int i=1;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}

	return 0 ;
}


#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll ;
int main(){
	int a ;
	cin >>a ;
	bool all = false ;
	if(a>4)
	{
		cout << a << endl ;
		for(int i=1;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}
		for(int i=2;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}

	}
	else
	{
		if(a==1||a==2)
		{
			cout << 1 << endl << 1 ;
		}
		if(a==3)
		{
			cout << 2 << endl << 1 << " " << 3 ;
		}
		if(a==4)
			cout << 4 << endl << 2 <<" "<<  4 << " " << 1 << " " << 3 ;
	}

	return 0 ;
}


#include <iostream>
#include<string>
#include<stack>
#include <math.h>
using namespace std;

int main(){
int x,d=0,m,h=0,count=0;
int a[5000],b[5000];
cin>>x;
if(x%2==0){
for(int i=2;i<=x;i+=2){
	a[d]=i;
	d++;
}//for
for(int i=1;i<=x;i+=2){
	a[d]=i;
	d++;

}//for
}
else
{
	for(int i=1;i<=x;i+=2){
	a[d]=i;
	d++;

}//for
	for(int i=2;i<=x;i+=2){
	a[d]=i;
	d++;
}//for

}
for(int i=1;i<x;i++){
	m=a[i-1];
	if(a[i]-1==m || a[i]+1==m){
		a[i]=m;
}

}//for
for(int i=1;i<x;i++){
	if(a[i]==a[i-1])
		count++;
	//cout<<a[i]<<" ";
}
cout<<x-count<<endl;
for(int i=0;i<x;i++){
	if(a[i]==a[i-1])
		continue;
	else
		cout<<a[i]<<" ";
}
	return 0;
}


#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll ;
int main(){
	int a ;
	cin >>a ;
	bool all = false ;
	if(a>4)
	{
		cout << a << endl ;
		for(int i=1;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}
		for(int i=2;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}

	}
	else
	{
		if(a==1||a==2)
		{
			cout << 1 << endl << 1 ;
		}
		if(a==3||a==4)
		{
			cout << 2 << endl << 1 << " " << 3 ;
		}
	}

	return 0 ;
}


#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll ;
int main(){
	int a ;
	cin >>a ;

		if(a!=2&&a!=3)
		{
		cout << a << endl ;
		for(int i=2;i<=a;i+=2)
		{
				cout << i << " ";
		}
		}else
			cout << a-1 << endl ;
		for(int i=1;i<=a;i+=2)
		{
				cout << i << " ";
		}

	return 0 ;
}


#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll ;
int main(){
	int a ;
	cin >>a ;
	bool all = false ;
	if(a>4)
	{
		cout << a << endl ;
		for(int i=1;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}
		for(int i=2;i<=a;i+=2)
		{
			if(i<=a)
			{
				cout << i << " ";
			}
		}

	}
	else
	{
		if(a==1||a==2)
		{
			cout << 1 << endl << 1 ;
		}
		if(a==3)
		{
			cout << 2 << endl << 1 << " " << 3 ;
		}
		if(a==4)
			cout << 4 << endl << 4 <<" "<<  1 << " " << 3 << " " << 2 ;
	}

	return 0 ;
}


#include <cstdio>
#include <cstdlib>
int n,i;
int main () {
scanf ("%d",&n);
if (n%2==0) printf ("%d\n",n);
else printf ("%d\n",n-1);
for (i=1;i<=n/2;i++)
printf ("%d %d ",i,i+n/2);

return 0;
}


#include <cstdio>
#include <cstdlib>
int n,i;
int main () {
scanf ("%d",&n);
if (n%2==0) printf ("%d\n",n);
else printf ("%d\n",n-1);
for (i=1;i<=n/2;i++)
printf ("%d %d ",i,i+(n+1)/2);

return 0;
}


#include <cstdio>
#include <cstdlib>
int n,i;
int main () {
scanf ("%d",&n);
if (n%2==0) printf ("%d\n",n);
if (n>1&&n%2==1) printf ("%d\n",n-1);
if (n==1) printf ("1\n1");
for (i=1;i<=n/2;i++)
printf ("%d %d ",i,i+(n+1)/2);

return 0;
}


#include <cstdio>
#include <cstdlib>
int n,i;
int main () {
scanf ("%d",&n);
if (n==3) printf ("2\n1 3");
if (n<3) printf ("1\n1");
if (n>3)
{
printf ("%d\n",n);

for (i=n-1;i>0;i-=2)
printf ("%d ",i);
for (i=n;i>0;i-=2)
printf ("%d ",i);
}

return 0;
}


#include <cstdio>
#include <cstdlib>
int n,i;
int main () {
scanf ("%d",&n);
if (n==3) printf ("2\n1 3");
if (n<3) printf ("1\n1");
if (n>3)
{
printf ("%d\n",n);

for (i=1;i<=n;i+=2)
printf ("%d ",i);
for (i=2;i<=n;i+=2)
printf ("%d ",i);
}

return 0;
}


#include<stdafx.h>
#include<math.h>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<vector>

using namespace std;

vector<bool> used;
vector<long> mas;
void main()
{
    long n, len;
    cin >> n;
    if (n == 1 || n == 2){
        cout << 1 <<'\n'<< 1;
    }
    if (n == 3 || n == 4){
        cout << 2 << '\n' << 1 << ' ' << 3;
    }
    if (n >= 5){
        cout << n << '\n';
        if (n % 2 == 1){
            for (long i = 1; i < n + 1; i++){
                cout << ((i - 1) * 2 + 1) % (n + 1) << ' ';
            }
        }
        else{
            for (long i = 1; i < n + 1; i+=2){
                cout << i << ' ';
            }
            for (long i = 2; i < n + 1; i+=2){
                cout << i << ' ';
            }
        }
    }
    return;
}


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

using namespace std;

vector<bool> used;
vector<long> mas;
void main()
{
    long n, len;
    cin >> n;
    if (n == 1 || n == 2){
        cout << 1 <<'\n'<< 1;
    }
    if (n == 3 || n == 4){
        cout << 2 << '\n' << 1 << ' ' << 3;
    }
    if (n >= 5){
        cout << n << '\n';
        if (n % 2 == 1){
            for (long i = 1; i < n + 1; i++){
                cout << ((i - 1) * 2 + 1) % (n + 1) << ' ';
            }
        }
        else{
            for (long i = 1; i < n + 1; i+=2){
                cout << i << ' ';
            }
            for (long i = 2; i < n + 1; i+=2){
                cout << i << ' ';
            }
        }
    }
    return;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else
    {
        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";
        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }
    system("pause");
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else if(n==4)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<2<<" "<<4<<endl;
    }
    else
    {

        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";

        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else if(n==4)
    {
        cout<<n<<endl;
        cout<<3<<" "<<1<<" "<<4<<" "<<2<<endl;
    }
    else
    {

        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";

        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else
    {
        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";
        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else if(n==4)
    {
        cout<<n-1<<endl;
        cout<<3<<" "<<1<<" "<<4<<" "<<2<<endl;
    }
    else
    {

        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";

        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else if(n==4)
    {
        cout<<n<<endl;
        cout<<3<<" "<<1<<" "<<2<<" "<<4<<endl;
    }
    else
    {

        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";

        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else
    {
        if(n%2!=0)
            n--;
        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";
        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%2!=0)
        n--;
    cout<<n<<endl;
    for(int i=1; i<=n; i+=2)
        cout<<i<<" ";
    for(int i=2; i<=n; i+=2)
        cout<<i<<" ";
    cout<<endl;

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else
    {
        if(n%2!=0)
            n--;
        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";
        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%2!=0)
        n--;
    cout<<n<<endl;
    for(int i=1; i<=n; i+=2)
        cout<<i<<" ";
    for(int i=2; i<=n; i+=2)
        cout<<i<<" ";
    cout<<endl;
    system("pause");
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<n<<endl;
        cout<<1<<endl;
    }
    else if(n==2)
    {
        cout<<n-1<<endl;
        cout<<1<<endl;
    }
    else if(n==3)
    {
        cout<<n-1<<endl;
        cout<<1<<" "<<3<<endl;
    }
    else if(n==4)
    {
        cout<<n-2<<endl;
        cout<<1<<" "<<4<<endl;
    }
    else
    {

        cout<<n<<endl;
        for(int i=1; i<=n; i+=2)
            cout<<i<<" ";

        for(int i=2; i<=n; i+=2)
            cout<<i<<" ";
        cout<<endl;
    }

    return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n==1)
	{
		cout<<n<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==2)
	{
		cout<<n-1<<endl;
		cout<<1<<endl;
		return 0;
	}
	f=0;
	if (n%2==0)
	{
		w=n-1;
		if (w-1==2+1) f=1;
	}
	else
	{
		w=n;
		if (w==2+1) f=1;
	}
	x=n-f;
	cout<<x<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	if (f==0) cout<<2<<' ';
	for (i=4;i<=n;i=i+2)
		cout<<i<<' ';
	cout<<endl;
	return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n==1)
	{
		cout<<n<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==2)
	{
		cout<<n-1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==0)
	{
		cout<<n<<endl;
		return 0;
	}
	f=0;
	if (n%2==0)
	{
		w=n-1;
		if (w-1==2+1) f=1;
	}
	else
	{
		w=n;
		if (w==2+1) f=1;
	}
	x=n-f;
	cout<<x<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	if (f==0) cout<<2<<' ';
	for (i=4;i<=n;i=i+2)
		cout<<i<<' ';
	cout<<endl;
	return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n==1)
	{
		cout<<n<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==2)
	{
		cout<<n-1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==0)
	{
		cout<<n<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<n-1<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	if (n==4)
	{
		cout<<n-1<<endl;
		cout<<1<<' '<<4<<' '<<2<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n-2;i=i+2)
		cout<<i<<' ';
	if (n%2==0) cout<<n<<endl; else cout<<n-1<<endl;
	return 0;

}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n<=2)
	{
		cout<<1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<2<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	if (n==4)
	{
		cout<<3<<endl;
		cout<<1<<' '<<4<<' '<<2<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n-2;i=i+2)
		cout<<i<<' ';
	if (n%2==0) cout<<n<<endl; else cout<<n-1<<endl;
	return 0;

}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n<=2)
	{
		cout<<1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<2<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	if (n==4)
	{
		cout<<3<<endl;
		cout<<1<<' '<<4<<' '<<2<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n-2;i=i+2)
		cout<<i<<' ';
	if (n%2==0) cout<<n<<endl; else cout<<n-1<<endl;
	return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n<=2)
	{
		cout<<1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<2<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	if (n==4)
	{
		cout<<4<<endl;
		cout<<3<<' '<<1<<' '<<4<<' '<<2<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n-2;i=i+2)
		cout<<i<<' ';
	if (n%2==0) cout<<n<<endl; else cout<<n-1<<endl;
	return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n==1)
	{
		cout<<n<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==2)
	{
		cout<<n-1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==0)
	{
		cout<<n<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<n-1<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n;i=i+2)
		cout<<i<<' ';
	cout<<endl;
	return 0;

}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	f=0;
	if (n%2==0)
	{
		w=n-1;
		if (w-1==2+1) f=1;
	}
	else
	{
		w=n;
		if (w==2+1) f=1;
	}
	x=n-f;
	cout<<x<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	if (f==0) cout<<2<<endl;
	for (i=4;i<=n;i=i+2)
		cout<<i<<' ';
	cout<<endl;
	return 0;
}


# include <iostream>
using namespace std;
int main()
{
	int n,w,f,i,x;
	cin>>n;
	if (n==1)
	{
		cout<<n<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==2)
	{
		cout<<n-1<<endl;
		cout<<1<<endl;
		return 0;
	}
	if (n==0)
	{
		cout<<n<<endl;
		return 0;
	}
	if (n==3)
	{
		cout<<n-1<<endl;
		cout<<1<<' '<<3<<endl;
		return 0;
	}
	if (n==4)
	{
		cout<<n-1<<endl;
		cout<<1<<' '<<4<<' '<<2<<endl;
		return 0;
	}
	cout<<n<<endl;
	for (i=1;i<=n;i=i+2)
		cout<<i<<' ';
	for (i=2;i<=n;i=i+2)
		cout<<i<<' ';
	cout<<endl;
	return 0;

}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	vector<int> ans;
	cin >> nn;
	for (int i = 1; i <= nn; i += 2) ans.push_back(i);
	for (int i = 2; i <= nn; i += 2) if (abs(ans[SZ(ans) - 1] - i) > 1) ans.push_back(i);
	cout << SZ(ans) << endl;
	REP(i, SZ(ans))cout << ans[i] << " " ;
	cout << endl;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	cin >> nn;
	if (nn == 1) cout << 1 << endl; else if (nn > 3) cout << nn << endl; else cout <<nn-1 << endl;
	for (int i = 1; i <= nn; i+=2) cout << i << " ";
	if(nn>3) for (int i = 2; i <= nn; i+=2) cout << i << " ";
	cout << endl;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i+=2) cout << i << " ";
	if(n>3) for (int i = 2; i <= n; i+=2) cout << i << " ";
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	vector<int> ans;
	cin >> nn;
	if (nn == 4){
		ans.push_back(3); ans.push_back(1); ans.push_back(4); ans.push_back(2);
	}
	else{
		for (int i = 1; i <= nn; i += 2) ans.push_back(i);
		for (int i = 2; i <= nn; i += 2) if (abs(ans[SZ(ans) - 1] - i) > 1) ans.push_back(i);
	}
	cout << SZ(ans) << endl;
	REP(i, SZ(ans))cout << ans[i] << " " ;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	cin >> nn;
	for (int i = 1; i <= nn; i+=2) cout << i << " ";
	if(nn>3) for (int i = 2; i <= nn; i+=2) cout << i << " ";
	cout << endl;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	vector<int> ans;
	cin >> nn;
	if (nn == 4){
		ans.push_back(1); ans.push_back(4); ans.push_back(2);
	}
	else{
		for (int i = 1; i <= nn; i += 2) ans.push_back(i);
		for (int i = 2*(nn/2); i >= 2; i -= 2) if (abs(ans[SZ(ans) - 1] - i) > 1) ans.push_back(i);
	}
	cout << SZ(ans) << endl;
	REP(i, SZ(ans))cout << ans[i] << " " ;
	cout << endl;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	cin >> nn;
	for (int i = 1; i <= nn; i+=2) cout << i << " ";
	if(nn>3) for (int i = 2; i <= nn; i+=2) cout << i << " ";
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>

using namespace std;
//#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define REP(i,n) for(int i=0; i<n; i++)
#define REPs(i,x,n) for(int i=x; i<n; i++)
#define SZ(x) x.size()
#define VVII vector< vector< pair<int, int> > >
#define mem(f, a) memset(f, a, sizeof(f))
#define all(c) (c).begin(), (c).end()
#define PB push_back
#define MP make_pair
#define epsil 1e-9
#define infinit  1e8
#define ll long long
#define PI pair<int, int>
#define X first
#define Y second

#define UNLINE_JUDGE

void __main() {
	int nn;
	vector<int> ans;
	cin >> nn;
	if (nn == 4){
		ans.push_back(1); ans.push_back(4); ans.push_back(2);
	}
	else{
		for (int i = 1; i <= nn; i += 2) ans.push_back(i);
		for (int i = 2; i <= nn; i += 2) if (abs(ans[SZ(ans) - 1] - i) > 1) ans.push_back(i);
	}
	cout << SZ(ans) << endl;
	REP(i, SZ(ans))cout << ans[i] << " " ;
	cout << endl;
}

int main(){
#ifndef UNLINE_JUDGE
	FILE* fin = NULL;
	fin = fopen("in.txt", "w+");
	fprintf(fin, "6");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #1 ...\n\tExpected: ");
	printf("6\n1 5 3 6 2 4");
	printf("\tReceived: ");
	__main();
	printf("\n");
	fin = fopen("in.txt", "w+");
	fprintf(fin, "3\n");
	fclose(fin);
	freopen("in.txt", "r", stdin);
	printf("Test Case #2 ...\n\tExpected: ");
	printf("2\n1 3");
	printf("\tReceived: ");
	__main();
	printf("\n");
#else
	__main();
#endif

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n==2)
	{
		cout<<"1"<<endl<<"1"<<endl;
	}
	else if(n==3)
	{
		cout<<"2"<<endl<<"1 3"<<endl;
	}
	else
	{
		cout<<n<<endl<<"1";
		for(int i=3;i<n;i+=2)
		{
			cout<<" "<<i;
		}
		for(int i=2;i<=n;i+=2)
		{
			cout<<" "<<i;
		}
		cout<<endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	if(n==1 || n==2)
	{
		cout<<"1"<<endl<<"1"<<endl;
	}
	else if(n==4)
	{
		cout<<"4"<<endl<<"3 1 4 2"<<endl;
	}
	else if(n==3)
	{
		cout<<"2"<<endl<<"1 3"<<endl;
	}
	else
	{
		cout<<n<<endl;
		for(int i=1;i<=n;i+=2)
		{
			cout<<i<<" ";
		}
		for(int i=2;i<=n;i+=2)
		{
			cout<<i<<" ";
		}
		cout<<endl;
	}
	return 0;
}