#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;
typedef long long LL ;
const int  N = 105;
const int  M = 1000;
int n,m,a,b,c,x,y;
char s[N][N];
int cnt=0;
int xx[4]={1,-1,0,0};
int yy[4]={0,0,1,-1};
void bfs(int a,int b)
{
	queue <int> q;
	q.push(a*M+b);
	while (!q.empty())
	{
		int x=q.front()/M;
		int y=q.front()%M;
		q.pop();
		for (int i=0;i<4;i++)
		{
			int px=x+xx[i];
			int py=y+yy[i];
			if (px>=0&&px<n&&py>=0&&py<m&&s[px][py]=='B')
			{
				s[px][py]='.';
				q.push(px*M+py);
			}
		}
	}
	cnt++;
}
int main()
{
	while (cin>>n>>m)
	{
		cnt=0;
		for (int i=0;i<n;i++)
			for (int j=0;j<m;j++)
				cin>>s[i][j];
		for (int i=0;i<n;i++)
			for (int j=0;j<m;j++)
			{
				if (s[i][j]=='B')
					bfs(i,j);
			}
		cout<<cnt<<endl;
	}
	return 0;
}


#include<cstdio>
#include<cstring>
char map[110][110];
bool vis[110][110];
int n,m;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
void dfs(int x,int y)
{
     if(x < 0 || x >= n || y < 0 || y >= m || map[x][y] != 'B' || vis[x][y])
        return;//
    vis[x][y] = true;
    for(int i = 0; i < 4 ; i++)
    {
        int xx = x + dx[i];
        int yy = y + dy[i];
        dfs(xx,yy);
    }
}
int main()
{
    int cnt = 0;
    scanf("%d%d",&n,&m);
    for(int i = 0 ; i < n ; i++)
        scanf("%s",map[i]);
    memset(vis,false,sizeof(vis));
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < m ; j++)
    {
        if(map[i][j] == 'B' && !vis[i][j])
        {
            dfs(i,j);
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


#include <iostream>
using namespace std;

int main() {
long long int n,m,sum=0,c=0;
	cin>>n>>m;
	char a[m];

	for(int i=0;i<n;i++)
	{
	    cin>>a;
	    if(i==(n-1))
	    for(int j=0;j<m;j++)
	    {
	        if(a[j]=='B')
	        {
	            sum++;
	            while(a[j]=='B')
	             {j++;

	             }
	             j--;
	        }

	    }
	}
	cout<<sum;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
int n,m,count=0;
	cin>>n;
	cin>>m;
	char str[105][105];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin>>str[i][j];
		}
	}
	for (int i = 0; i < m; i++)
	{
		if (str[n-1][i]=='B')
		{

			while(str[n-1][i]=='B')
			{
				i++;
			}
			count++;

		}
	}
cout<<count;
}


#include<bits/stdc++.h>
using namespace std;
int h, w, cy[4] = {0, 0, -1, 1}, cx[4] = {1, -1, 0, 0}, nx, ny;
char arr[101][101];
void fill(int y, int x){
	for(int i=0; i<4; i++){
		nx = x + cx[i];
		ny = y + cy[i];
		if(nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
		if(arr[ny][nx] == 'B'){
			arr[ny][nx] = '.';
			fill(ny, nx);
		}
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int out = 0;
	cin >> h >> w;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++) cin >> arr[i][j];
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(arr[i][j] == 'B'){
				out++;
				fill(i, j);
			}
		}
	}
	cout << out;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <queue>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <bitset>

#define ll long long

using namespace std;

const int MAXN=0;
int n;

int main()
{
      int r, c;
      cin >> r >> c;
      string s;
      for (int i=0;i<r-1;i++) cin >> s;
      cin >> s;
      int num=0;
      for (int i=0;i<c;i++){
            if (s[i]=='B'){
                  num++;
                  while (s[i]=='B') i++;
                  i--;
            }
      }
      cout << num << endl;
      return 0;
}


#include <iostream>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll H, W;
char S[200][200];
ll visited[200][200];

bool isin(ll y, ll x) {
  return 0 <= y && y < H && 0 <= x && x < W;
}

void dfs(ll y, ll x) {
  ll dd[5] = { 0, 1, 0, -1, 0 };

  if(visited[y][x]) return;
  visited[y][x] = true;

  REP(i, 0, 4) {
    ll ny = y + dd[i];
    ll nx = x + dd[i + 1];
    if(isin(ny, nx) && S[ny][nx] == 'B') {
      dfs(ny, nx);
    }
  }
}

int main(void) {
  cin >> H >> W;
  REP(i, 0, H) cin >> S[i];

  REP(i, 0, H) REP(j, 0, W) visited[i][j] = false;

  ll ans = 0;
  REP(i, 0, H) REP(j, 0, W) {
    if(S[i][j] == 'B' && !visited[i][j]) {
      dfs(i, j);
      ans++;
    }
  }
  cout << ans << endl;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <bitset>
//#include "sdf.hpp"

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)

typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 100000 + 7;
const int M = 59;
const int mid = M / 2;
const int mod = 1e9 + 9;
const int inf = 1e6 + 3;
const ll linf = 1ll * inf * inf;
const double pi = acos(-1);
const double eps = 1e-7;
const double ep = 1e-5;
const int maxn = 1e5 + 7;
const double PI = acos(-1);

int lt[N], invlt[N];

int inverse(int x, int n){
    int r = n, newr = x;
    int t = 0, newt = 1;
    while (newr > 0){
        int q = r / newr;
        int tmp = newr;
        newr = r % newr;
        r = tmp;

        tmp = newt;
        newt = t - q * newt;
        t = tmp;
    }
    if (t < 0) t += n;
    return t;
}

void init() {
    lt[0] = invlt[0] = 1;
    rep(i, 1, N) {
        lt[i] = (ll) lt[i - 1] * i % inf;
        invlt[i] = inverse(lt[i], inf);
    }
}

int C(int n, int k) {
    return (ll) lt[n] * invlt[n - k] % inf * invlt[k] % inf;
}

void solve() {
    int n, m;
    cin >> n >> m;
    char s[N];
    rep(i, 0, n) scanf("%s", s);
    int ans = 0;
    rep(i, 0, m) {
        if (s[i] == 'B') {
            if (i == 0 || s[i - 1] != 'B') ans++;
        }
    }
    cout << ans;
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
    int T = 1;
    //cin >>T;
    //cout << T << "\n";
    rep(i, 1, T + 1) {
        //printf("Case #%d: ", 1i);
        //        m = i;
        solve();
        //cout << prime.size() << "\n";
    }

}


#include<iostream>
#define MAX_N 110
using namespace std;
int R,C;
char wall[MAX_N][MAX_N];
bool used[MAX_N][MAX_N];
int dir[4][2]={0,1,0,-1,1,0,-1,0};
void dfs(int x,int y){
  used[x][y]=true;
  for(int i=0;i<4;i++){
    int xx=x+dir[i][0],yy=y+dir[i][1];
    if(xx>=0&&xx<R&&yy>=0&&yy<C&&!used[xx][yy]&&wall[xx][yy]=='B'){
      dfs(xx,yy);
    }
  }
}
void solve(){
  int cnt=0;
  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      if(wall[i][j]=='B'&&!used[i][j]){
        dfs(i,j);
        cnt++;
      }
    }
  }
  cout<<cnt<<endl;
}
int main(){
  cin>>R>>C;
  for(int i=0;i<R;i++){
    cin>>wall[i];
  }
  solve();
  return 0;
}


#include<iostream>
#define MAX_N 10000
using namespace std;
long long a[MAX_N],N;
void solve(){
  long long cnt=0;
  for(int i=0;i<N;i++){
    if(a[i]>1){
      cnt+=a[i]*(a[i]-1)/2;
    }
  }
  cout<<cnt<<endl;
}
int main(){
  cin>>N;
  for(int i=0;i<N-1;i++){
    long long x,y;
    cin>>x>>y;
    a[x-1]++;
    a[y-1]++;
  }
  solve();
  return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxd = 4;
const int dy[Maxd] = {-1, 0, 1, 0};
const int dx[Maxd] = {0, -1, 0, 1};
const int Maxn = 105;

int R, C;
char B[Maxn][Maxn];
int res;

void Fill(int r, int c)
{
	if (r < 0 || r >= R || c < 0 || c >= C || B[r][c] == '.') return;
	B[r][c] = '.';
	for (int i = 0; i < Maxd; i++)
		Fill(r + dy[i], c + dx[i]);
}

int main()
{
	scanf("%d %d", &R, &C);
	for (int i = 0; i < R; i++)
		scanf("%s", B[i]);
	for (int i = 0; i < R; i++)
		for (int j = 0; j < C; j++) if (B[i][j] == 'B') {
			res++; Fill(i, j);
		}
	printf("%d\n", res);
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	int r, c, i, count = 0;
	bool inwall = false;
	scanf("%d%d", &r, &c);
	cin.ignore();
	string wall[r];
	for (i=0;i<r;i++) getline(cin, wall[i]);
	for (i=0;i<c;i++)
	{
		if (wall[r-1][i]=='B')
		{
			if (!inwall) count++;
			inwall = true;
		} else inwall = false;
	}
	printf("%d\n", count);
}


#include<iostream>
#include<vector>

using namespace std;

int main() {
    int r, c;
    cin >> r;
    cin >> c;
    // ignore first r-1 rows
    for (int i = 0; i < r - 1; ++i) {
        for (int j = 0; j < c; ++j) {
            char a;
            cin >> a;
        }
    }
    // read last row
    vector<char> a(c);
    for (int j = 0; j < c; ++j) {
        cin >> a[j];
    }
    // process
    int count = 0;
    for (int j = 0; j < c; ++j) {
        if (a[j] == 'B' && (j == 0 || a[j-1] == '.')) {
            ++count;
        }
    }
    cout << count;
    return 0;
}


#include<iostream>
#include<vector>

int main() {
    int r, c;
    cin >> r;
    cin >> c;
    // ignore first r-1 rows
    for (int i = 0; i < r - 1: ++i) {
        for (int j = 0; j < c; ++j) {
            char a;
            cin >> a;
        }
    }
    // read last row
    vector<char> a(n);
    for (int j = 0; j < c; ++j) {
        cin >> a[j]
    }
    // process
    int count = 0;
    for (int j = 0; j < c; ++j) {
        if (a[j] == 'B' && (j == 0 || a[j-1] == '.')) {
            ++count;
        }
    }
    cout << count;
    return 0;
}


#include<cstdio>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

const int maxn=105;

int n,m;
char mp[maxn][maxn];

bool bz[maxn][maxn];
int fx[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
void dfs(int x,int y)
{
	bz[x][y]=1;
	fo(k,0,3)
	{
		int xx=x+fx[k][0], yy=y+fx[k][1];
		if (xx && xx<=n && yy && yy<=m && mp[xx][yy]=='B' && !bz[xx][yy]) dfs(xx,yy);
	}
}

int main()
{
	freopen("D1.in","r",stdin);
	freopen("D1.out","w",stdout);

	scanf("%d %d\n",&n,&m);
	fo(i,1,n)
	{
		fo(j,1,m) scanf("%c",&mp[i][j]);
		scanf("\n");
	}

	int ans=0;
	fo(i,1,n)
		fo(j,1,m) if (mp[i][j]=='B' && !bz[i][j])
		{
			ans++;
			dfs(i,j);
		}

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


#include<cstdio>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

const int maxn=105;

int n,m;
char mp[maxn][maxn];

bool bz[maxn][maxn];
int fx[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
void dfs(int x,int y)
{
	bz[x][y]=1;
	fo(k,0,3)
	{
		int xx=x+fx[k][0], yy=y+fx[k][1];
		if (xx && xx<=n && yy && yy<=m && mp[xx][yy]=='B' && !bz[xx][yy]) dfs(xx,yy);
	}
}

int main()
{
	//freopen("D1.in","r",stdin);
	//freopen("D1.out","w",stdout);

	scanf("%d %d\n",&n,&m);
	fo(i,1,n)
	{
		fo(j,1,m) scanf("%c",&mp[i][j]);
		scanf("\n");
	}

	int ans=0;
	fo(i,1,n)
		fo(j,1,m) if (mp[i][j]=='B' && !bz[i][j])
		{
			ans++;
			dfs(i,j);
		}

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


#include <bits/stdc++.h>

using namespace std;

int n,m;
bool f=0;
char mat[555][555];
bool vis[555][555]={0};
int mx[]={0,0,1,-1};
int my[]={1,-1,0,0};

bool out(int x,int y){
    return (x<0 || y<0 || x>=n || y>=m );
}
void dfs(int x,int y){
    if( out(x,y) || vis[x][y] || mat[x][y]=='.' ) return;
    vis[x][y]=1;
    for(int i=0;i<4;i++){
        int xx=x+mx[i];
        int yy=y+my[i];

        if( !out(xx,yy) && !vis[xx][yy] && mat[xx][yy]!='.')
            dfs(xx,yy);
    }
}
int main()
{
    memset(vis,0,sizeof vis);
    cin>>n>>m;
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>mat[i][j];
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if( mat[i][j]!='.' && vis[i][j]==0 ){
                dfs(i,j);
                ans++;
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 100 + 5;

const int dr[] = {1, -1, 0, 0};

const int dc[] = {0, 0, 1, -1};

char a[maxn][maxn];

int vis[maxn][maxn];

void dfs(int r, int c){

    vis[r][c] = 1;

    for(int i = 0; i < 4; ++i){

        int x = r + dr[i];

        int y = c + dc[i];

        if(!vis[x][y] && a[x][y] == 'B')  dfs(x, y);

    }

}

int main(){

    int r, c;

    cin >> r >> c;

    getchar();

    memset(vis, 0, sizeof(vis));

    for(int i = 0; i < r; ++i)  cin >> a[i];

    int ans = 0;

    for(int i = 0; i < r; ++i)

        for(int j = 0; j < c; ++j)

            if(a[i][j] == 'B' && !vis[i][j]){

                ++ans;

                dfs(i, j);

            }

    cout << ans << endl;

    return 0;

}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int rt,ct;
char pic[105][105];
int idx[105][105];
void dfs(int r,int c,int id)
{
    if(r<0||r>=rt||c<0||c>=ct) return;
    if(idx[r][c]>0||pic[r][c]!='B') return;
    idx[r][c]=id;
    for(int dr=-1;dr<=1;dr++)
    {
        for(int dc=-1;dc<=1;dc++)
        if((abs(dc)+abs(dr)==1))
        dfs(r+dr,c+dc,id);
    }
}
int main()
{
    while(~scanf("%d%d",&rt,&ct))
    {
        memset(idx,0,sizeof(idx));
        memset(pic,0,sizeof pic);
        getchar();
        char a;
        for(int i=0;i<rt;i++)
        {
            for(int j=0;j<ct;j++)
            {
                scanf("%c",&a);
                pic[i][j]=a;
            }
            getchar();
        }
        int cnt=0;
        for(int i=0;i<rt;i++)
        {
            for(int j=0;j<ct;j++)
            if(idx[i][j]==0&&pic[i][j]=='B') dfs(i,j,++cnt);
        }
        printf("%d\n",cnt);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
main(){
    int m,n,i=0,rep=0;
    char s[100];
    for(scanf("%d%d",&m,&n);i<m;i++)scanf("%s",&s);
    for(i=1;i<n;i++)rep+=s[i-1]=='.'&&s[i]=='B';
    printf("%d",rep+=s[0]=='B');
}


#include <stdio.h>
#include <iostream>
using namespace std;

int p[5][2]={0,0,1,0,-1,0,0,1,0,-1};
int n,m;
char s[105][105];
bool used[105][105];
int x[100005],y[100005];

void bfs(int xs,int ys)
{
    int start=1,ends=2;
    x[1]=xs;
    y[1]=ys;
    used[xs][ys]=1;
    while (start<ends)
        {
        int x1=x[start];
        int y1=y[start];
        for (int k=1;k<=4;k++)
            {
            int x2,y2;
            x2=x1+p[k][0];
            y2=y1+p[k][1];
            if (x2<1 || x2>n || y2<1 || y2>m) continue;
            if (used[x2][y2]) continue;
            if (s[x2][y2]!='B') continue;
            used[x2][y2]=1;
            x[ends]=x2;
            y[ends]=y2;
            ends++;
            }
        start++;
        }
}

int main()
{
    scanf ("%d %d",&n,&m);
    int ans=0;
    for (int i=1;i<=n;i++)
        scanf ("%s",s[i]+1);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            if (s[i][j]=='B' && used[i][j]==0)
                bfs(i,j), ans++;
    printf ("%d",ans);
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
long long R,C, segmentos=0;
	string s;
	cin>>R>>C;
	for(int i=0;i<R;i++){
		cin>>s;
    	s='.'+s;
	}
	for(int i=1;i<=C;i++){
		if(s[i-1]=='.' && s[i]=='B'){
		   segmentos++;
		}
	}
    cout<<segmentos<<endl;

	return 0;
}


#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define elif else if
#define ll long long
#define ull unsigned long long

using namespace std;

int main()
{
    int r,c;
    cin >> r >> c;
    for (int i = 1; i<r; i++)
    {
        string num;
        cin >> num;
    }
    string num;
    cin >> num;
    int answer = 0;
    for (int i = 0; i<num.length(); ++i)
    {
        if (num[i] == 'B')
        {
            answer++;
            while (num[i] == 'B')
            {
                i++;
            }
            i--;
        }
    }
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
main()
{
    char wall[100][100];
    bool bricks[100];
    int r,c;
    int segments=0;
    cin>>r>>c;
    for(int i=0 ; i<r ; i++)
        for(int j=0 ; j<c ; j++)
            cin>>wall[i][j];

    for(int i=0 ; i<c ; i++)
    {
        if(wall[r-1][i]=='B')
            bricks[i]=true;
    }

    for(int i=0 ; i<c ; i++)
    {
        if(bricks[i])
        {
            int pnt=i+1;
            while(bricks[pnt]&&pnt<c)
                pnt++;
            segments++;
            i=pnt;
        }
    }

    cout<<segments<<endl;

    return 0;
}


#include <stdio.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include <algorithm>
#include<typeinfo>
using namespace std;

char alphabet[27]={"abcdefghijklmnopqrstuvwxyz"};
char Alphabet[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
long long m,n,a,b,k,kol=0,s=0,i,j,x,y,take,r,c;

 void rev(char s [])
{
int a = strlen(s);
for(int h = 0;h <a/2;h++)

{

char sim = s [h];
s [h] = s [a-h-1];
s [a-h-1] = sim;
}
}

int gcd(long long a, long long b)
{

if (b == 0)
return a;

else
return gcd (b, a % b);

}

int main()
{
string str1;
string str2;
string str3;

//cin>>str>>str1;

cin>>r>>c;
//long long u=k -y%k;

long long mas1[n];
long long mas2[n];
long long mas3[n];
long long mas4[4001];
long long mas[100];
long long minus=0;
char sim;

kol = c;

for(long long i=0; i<(r-1)*c; i++)
    cin>>sim;

for(long long i=0; i<c; i++)
    cin>>str1[i];

for(long long i=0; i<c; i++)
{

    if(str1[i]=='B' && str1[i+1]=='B')
    kol--;

    if(str1[i]=='.')
    kol--;

}

cout<<kol<<endl;

//for(long long i=0; i<kol; i++)
//cout<<mas4[i]+1<<" ";

}


#include <stdio.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include <algorithm>
#include<typeinfo>
using namespace std;

char alphabet[27]={"abcdefghijklmnopqrstuvwxyz"};
char Alphabet[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
long long m,n,a,b,k,kol=0,s=0,i,j,x,y,take,r,c;

 void rev(char s [])
{
int a = strlen(s);
for(int h = 0;h <a/2;h++)

{

char sim = s [h];
s [h] = s [a-h-1];
s [a-h-1] = sim;
}
}

int gcd(long long a, long long b)
{

if (b == 0)
return a;

else
return gcd (b, a % b);

}

int main()
{
string str1;
string str2;
string str3;

//cin>>str>>str1;

cin>>r>>c;
//long long u=k -y%k;

long long mas1[n];
long long mas2[n];
long long mas3[n];
long long mas4[4001];
long long mas[100];
long long minus=0;
char sim;

for(long long i=0; i<(r-1)*c; i++)
    cin>>sim;

for(int i=0;i<c;i++)
{
cin>>sim;

if (sim=='.')
m=0;

else
m=1;

if(a==0)
{
    if(m==1)
kol++;
    }

a=m;
}

cout<<kol<<endl;

//for(long long i=0; i<kol; i++)
//cout<<mas4[i]+1<<" ";

}


#include <iostream>

using namespace std;
int n,m,mat[102][102],k=1;
int Lee(int x, int y)
{
    if ((x<1) || (x>n) || (y<1) || (y>m) || mat[x][y]!=1) return 0;
    mat[x][y]=k;
    Lee(x-1,y);
    Lee(x+1,y);
    Lee(x,y-1);
    Lee(x,y+1);
    return 0;
}

int main ()
{
  cin >> n >> m;
  for (int i=1; i<=n; i++)
      for (int j=1; j<=m; j++)
      {
         char ch;
         cin >> ch;
         if (ch=='.') mat[i][j]=0;
         else mat[i][j]=1;
      }

  for (int i=1; i<=n; i++)
      for (int j=1; j<=m; j++)
      if (mat[i][j]==1)
      {
         k++;
         Lee(i,j);
         //break;
      }
  cout << --k;
  return 0;
}


#include <iostream>
//
using namespace std;
int n,m,mat[102][102],k=1;
int Lee(int x, int y)
{
    if ((x<1) || (x>n) || (y<1) || (y>m) || mat[x][y]!=1) return 0;
    mat[x][y]=k;
    Lee(x-1,y);
    Lee(x+1,y);
    Lee(x,y-1);
    Lee(x,y+1);
    return 0;
}

int main ()
{
  cin >> n >> m;
  for (int i=1; i<=n; i++)
      for (int j=1; j<=m; j++)
      {
         char ch;
         cin >> ch;
         if (ch=='.') mat[i][j]=0;
         else mat[i][j]=1;
      }

  for (int i=1; i<=n; i++)
      for (int j=1; j<=m; j++)
      if (mat[i][j]==1)
      {
         k++;
         Lee(i,j);
         //break;
      }
  cout << --k;
  return 0;
}


#include<cstdio>

char wall[102][102];
bool counted[102][102];

void dfs(int x,int y,int R,int C)
{
    //printf("\t%d %d [%c]\n",x,y,wall[x][y]);
    if(counted[x][y] || x< 0 || x >= R || y < 0 || y >= C)
        return;
    if(wall[x][y]!='B')
        return;
    counted[x][y]=true;
    dfs(x-1,y,R,C);
    dfs(x+1,y,R,C);
    dfs(x,y-1,R,C);
    dfs(x,y+1,R,C);
}

int main()
{
    int R,C;
    scanf("%d %d",&R,&C);
    for(int i = 0;i<R;i++)
    {
        scanf("%s",wall[i]);
    }
    int count = 0;
    for(int i = 0;i<R;i++)
    {
        for(int j=0;j<C;j++)
        {
            if(counted[i][j] || wall[i][j]=='.')
                continue;
            count++;
            //printf("Start: %d %d [%c]\n",i,j,wall[i][j]);
            dfs(i,j,R,C);
        }
    }
    printf("%d\n",count);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int maxn = 100 + 5;
const int dr[] = {1, -1, 0, 0};
const int dc[] = {0, 0, 1, -1};
char a[maxn][maxn];
int vis[maxn][maxn];

void dfs(int r, int c){
    vis[r][c] = 1;
    for(int i = 0; i < 4; ++i){
        int x = r + dr[i];
        int y = c + dc[i];
        if(!vis[x][y] && a[x][y] == 'B')  dfs(x, y);
    }
}

int main(){
    int r, c;
    cin >> r >> c;
    getchar();
    memset(vis, 0, sizeof(vis));
    for(int i = 0; i < r; ++i)  cin >> a[i];
    int ans = 0;
    for(int i = 0; i < r; ++i)
        for(int j = 0; j < c; ++j)
            if(a[i][j] == 'B' && !vis[i][j]){
                ++ans;
                dfs(i, j);
            }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double PI = 3.14159265359;
const double EPS = 1e-9;
// const int INF = (2e9);
const ll INF = ((ll)1 << 62);

const ll P = 1e9 + 7;

int visited[105][105];

int moves[4][4] = { { 0, 1 }, { 1, 0 }, { -1, 0 }, { 0, -1 } };

void dfs(int y, int x, vector<string> &rows){
  if(rows[y][x] != 'B' || visited[y][x]) return;

  visited[y][x] = 1;

  for(int i=0; i < 4; i++){
    int ny = moves[i][0] + y;
    int nx = moves[i][1] + x;

    dfs(ny, nx, rows);
  }

  return;
}

int main(){
  std::ios::sync_with_stdio(false);
  int r, c;
  cin >> r >> c;

  vector<string> rows;
  rows.pb(string(c + 2, '#'));
  string tmp;
  for (int i = 0; i < r; ++i)
  {
    cin >> tmp;
    rows.pb("#" + tmp + "#");
  }
  rows.pb(string(c + 2, '#'));

  int comps = 0;
  for(int i=1; i<=r; i++){
    for(int j=1; j<=c; j++){
      if(!visited[i][j] && rows[i][j] == 'B'){
        comps++;
        dfs(i, j, rows);
      }
    }
  }
  cout << comps << endl;

  return 0;
}


#include<iostream>

using namespace std;

int main()
{
    int R, C;
    cin >> R >> C;
	char temp;
	int seg = 0;
	int l = 0;
	for(int i = 0; i < (R-1)*C; i++)
    {
        cin >> temp;
    }
    for(int i = 0; i < C; i++)
    {
        cin >> temp;
        if(temp == '.')
        {
            l++;
        }else
        {
            if(l != 0)
            {
                seg++;
                l = 0;
            }
        }
    }
    cout << seg << endl;
    return 0;
}


#include<iostream>

using namespace std;

int main()
{
    int R, C;
    cin >> R >> C;
	char temp;
	int seg = 1;
	int l = 0;
	for(int i = 0; i < (R-1)*C; i++)
    {
        cin >> temp;
    }
    for(int i = 0; i < C; i++)
    {
        cin >> temp;
        if(temp == 'B')
        {
            l++;
        }else
        {
            if(l != 0)
            {
                seg++;
                l = 0;
            }
        }
    }
    cout << seg << endl;
    return 0;
}


#include<iostream>

using namespace std;

int main()
{
    int R, C;
    cin >> R >> C;
	char temp;
	int seg = 0;
	int l = 0;
	for(int i = 0; i < (R-1)*C; i++)
    {
        cin >> temp;
    }
    for(int i = 0; i < C; i++)
    {
        cin >> temp;
        if(temp == 'B')
        {
            l++;
        }else
        {
            if(l != 0)
            {
                seg++;
                l = 0;
            }
        }
    }
    if(l>0) seg++;
    cout << seg << endl;
    return 0;
}


#include<iostream>

using namespace std;

int main()
{
    int R, C;
    cin >> R >> C;
	char temp;
	int seg = 0;
	int l = 0;
	for(int i = 0; i < (R-1)*C; i++)
    {
        cin >> temp;
    }
    for(int i = 0; i < C; i++)
    {
        cin >> temp;
        if(temp == 'B')
        {
            l++;
        }else
        {
            if(l != 0)
            {
                seg++;
                l = 0;
            }
        }
    }
    if(l<0) seg++;
    cout << seg << endl;
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int n, m;
string wall[101];

void DFS(int i, int j) {
    wall[i][j] = '.';

    for(int k = 0; k < 8; k++) {
        int nx, ny;
        nx = i + dx[k];
        ny = j + dy[k];

        if(nx >= 0 && nx < n && ny >= 0 && ny < m && wall[nx][ny] != '.')
            DFS(nx, ny);
    }
}

int main() {
    int c = 0;
    cin >> n >> m;

    for(int i = 0; i < n; i++) cin >> wall[i];

    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            if(wall[i][j] == 'B') {
                c++;
                DFS(i, j);
            }

    cout << c << endl;

    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
char Map[105][105];
bool flag[105][105];
int num;
int n,m;
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
bool check(int x,int y)
{
    if(x<0||x>=n||y<0||y>=m||flag[x][y]==1||Map[x][y]!='B')
        return false;
    return true;
}
int dfs(int x,int y,int group)
{
    flag[x][y]=1;
    for(int i=0;i<4;i++)
    {
        int xx=x+dx[i];
        int yy=y+dy[i];
        if(check(xx,yy))
            dfs(xx,yy,group);
    }
    return group;
}
int main()
{
    memset(flag,0,sizeof(flag));
    num=0;
    scanf("%d%d",&n,&m);
    int i,j;
    for(i=0;i<n;i++)
    {
      scanf("%s",Map[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(Map[i][j]=='B'&&flag[i][j]!=1)
            {
                num=dfs(i,j,num+1);
            }
        }
    }
    printf("%d\n",num);
    return 0;
}


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

int m,n,cnt;
char map[105][105];

void dfs(int i,int j){
	if(map[i][j]!='B'||i<1||j<1||i>n||j>m)
		return ;
	else {
		map[i][j] = '#';
        dfs(i-1, j);
        dfs(i, j-1);
        dfs(i, j+1);
        dfs(i+1, j);
	}
}

int main(){
	int i,j;
	while(cin>>n>>m){
		if(m == 0||n == 0) break;
		for(i = 1;i<=n;i++)
			for(j = 1;j<=m;j++)
				cin>>map[i][j];
		cnt = 0;
		for(i = 1;i<=n;i++)
			for(j = 1;j<=m;j++){
				if(map[i][j] == 'B'){
					dfs(i,j);
					cnt++;
				}
			}
		printf("%d\n",cnt);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int n;
int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        if(n==1||n==2)
        {
            printf("%d\n",1);
            printf("%d\n",1);
        }
        if(n==3)
        {
            printf("%d\n",2);
            printf("%d %d\n",1,3);
        }
        if(n==4)
        {
            printf("%d\n",4);
            printf("%d %d %d %d\n",1,3,4,2);
        }
        if(n>4)
        {
            printf("%d\n",n);
            for(int i=1;i<=n;i+=2)
            {
                printf("%d ",i);
            }

            for(int i=2;i<n;i+=2)
            {
                printf("%d ",i);
            }
            if(n%2==0)
            {
            printf("%d ",n);
            }
            printf("\n");
        }
    }
    return 0;
}


#include<cstdio>
#include<cmath>
int n;
 int main()
 {    while (scanf("%d",&n)!=EOF)
     {        if (n==1) {printf("1\n1\n");continue; }
        if (n==2) {printf("1\n1\n"); continue;}
        if (n==3) {printf("2\n1 3\n"); continue;}
        if (n==4) {printf("4\n2 4 1 3\n"); continue;}
        printf("%d\n",n);
        printf("1");
     for (int i=3 ;i<=n ;i+=2) printf(" %d",i);
    for (int i=2 ;i<=n ;i+=2) printf(" %d",i);
        printf("\n");
        }
    return 0;
 }


#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
    int n;
    while (scanf ("%d",&n)&&(n>=1))
    {
        if(n==1||n==2)
        { printf("1\n1\n");continue;}
        if(n==3)
        {printf("2\n1 3\n");continue;}
        if(n==4){
            printf("4\n3 1 4 2\n");continue;}
            printf("%d\n",n);
            int i=1;
            while (i<=n)
            {
                printf("%d ",i);
                i+=2;
            }
            i=2;
            while (i<n-1)
            {
                printf("%d ",i);
                i+=2;
            }
            if(n%2==0)
                printf("%d",n);
            else
                printf("%d",n-1);
            printf("\n");
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int n;
int main()
{
    while(scanf("%d",&n)!=EOF)
    {
        if(n==1||n==2)
        {
            printf("%d\n",1);
            printf("%d\n",1);
        }
        if(n==3)
        {
            printf("%d\n",2);
            printf("%d %d\n",1,3);
        }
        if(n==4)
        {
            printf("%d\n",4);
            printf("%d %d %d %d\n",1,3,4,2);
        }
        if(n>4)
        {
            printf("%d\n",n);
            for(int i=1;i<=n;i+=2)
            {
                printf("%d ",i);
            }

            for(int i=2;i<n;i+=2)
            {
                printf("%d ",i);
            }
            if(n%2==0)
            {
            printf("%d",n);
            }
            printf("\n");
        }
    }
    return 0;
}


#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
    int n;
    while (scanf ("%d",&n)&&(n>=1))
    {
        if(n==1||n==2)
            printf("1\n1\n");
        if(n==3)
            printf("2\n1 3\n");
        if(n==4)
            printf("4\n3 1 4 2\n");
        if(n>=5)
        {
            int i=1;
            while (i<=n)
            {
                printf("%d ",i);
                i+=2;
            }
            i=2;
            while (i<n-1)
            {
                printf("%d ",i);
                i+=2;
            }
            if(n%2==0)
                printf("%d",n);
            else
                printf("%d",n-1);
            printf("\n");
        }
    }
    return 0;
}


 #include<cstdio>
 #include<cmath>
#define inf 0x7fffffff

int n;

 int main()
 {    while (scanf("%d",&n)!=EOF)
     {        if (n==1) {printf("1\n1\n"); }
        if (n==2) {printf("1\n1\n"); }
        if (n==3) {printf("2\n1 3\n"); }
        if (n==4) {printf("4\n2 4 1 3\n"); }
        printf("%d\n",n);
        printf("1");
     for (int i=3 ;i<=n ;i+=2) printf(" %d",i);
    for (int i=2 ;i<=n ;i+=2) printf(" %d",i);
        printf("\n");
        }
    return 0;
 }


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

        cout << endl;
        }
     }
     else
     {
            cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mod 1000000007
#define reset(s,val) memset(s,val,sizeof(s))
#define eps 0.0000001
#define pi acos(-1)
#define sqr(x) (x)*(x)
#define maxn 32000

int n;

int main( ){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    if(n==1||n==2) cout<<1<<endl<<1;
    else if(n==3) cout<<2<<endl<<"1 3";
    else if(n==4) cout<<4<<endl<<"2 4 1 3";
    else
    {
        cout<<n<<endl;
        for(int i=1;i<=n;i+=2) cout<<i<<' ';
        for(int i=2;i<=n;i+=2) cout<<i<<' ';
    }
}


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

        cout << endl;
     }
     else
     {
            cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


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

        cout << endl;
        }
     }
     else
     {
        cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


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

        cout << endl;
        }
     }
     else
     {
        cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


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

        cout << endl;
        }
     }
     else
     {
        cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


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

        cout << endl;
        }
     }
     else
     {
        cout << n <<endl;
        for(int i=1;i<=n/2;i++)
             cout << i << " " << i+n/2 << " ";

        cout << endl;
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long x,n,i;
	cin >> n;
	if(n==2 || n==1)	cout << 0 << endl;
	else
	{
		if(n%2!=0)
		{
			cout << n-1 << endl;
			x=n/2+1;
		}
		else
		{
			cout << n << endl;
			x=n/2;
		}
		for(i=1;i<=n/2;i++)
		{
			cout << i << " " << x+i << " ";
		}
		cout << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long x,n,i;
	cin >> n;
	if(n==1||n==2)	cout << 1 << endl << 1 << endl;
	else
	{
		if(n%2!=0)
		{
			cout << n-1 << endl;
			x=n/2+1;
		}
		else
		{
			cout << n << endl;
			x=n/2;
		}
		for(i=1;i<=n/2;i++)
		{
			cout << x+i << " " << i << " ";
		}
		cout << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long x,n,i;
	cin >> n;
	if(n==1||n==2)	cout << 1 << endl << 1 << endl;
	else
	{
		if(n%2!=0)
		{
			cout << n-1 << endl;
			x=n/2+1;
		}
		else
		{
			cout << n << endl;
			x=n/2;
		}
		for(i=1;i<=n/2;i++)
		{
			cout << i << " " << x+i << " ";
		}
		cout << endl;
	}
	return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

        for (int j = 2; j <= n; j += 2)
            cout << j << " ";

        cout << endl;
    }

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

        for (int j = 2; j <= n ; j += 2)
            cout << j << " ";

        cout << endl;
    }

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

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

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

        for (int j = 2; j <= n - 2; j += 2)
            cout << j << " ";

        if ( (n)%2 == 0)
            cout << n;
        else
            cout << n-1;

        cout << endl;
    }

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else if (n == 4){
        cout << 4 << endl;
        cout << 2 << " " << 4 << " " << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

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

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

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

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else if(n==4)
    {
        cout<<"4"<<endl;
        cout<<"3 1 4 2"<<endl;
        return 0;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

        for (int j = 2; j <= n - 2; j += 2)
            cout << j << " ";

        if ( (n)%2 == 0)
            cout << n;
        else
            cout << n-1;

        cout << endl;
    }

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 2){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 3){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 2; i <= n; i += 2)
            cout << i << " ";

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

    return 0;
}


//Codeforces  534 A
//http://codeforces.com/problemset/problem/534/A

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    if (n == 1){
        cout << 1 << endl;
        cout << 1 << endl;
    }
    else if (n == 2){
        cout << 2 << endl;
        cout << 1 << " " << 3 << endl;
    }
    else{
        cout << n << endl;
        for (int i = 1; i <= n; i += 2)
            cout << i << " ";

        for (int j = 2; j <= n - 2; j += 2)
            cout << j << " ";

        if ( (n)%2 == 0)
            cout << n;
        else
            cout << n-1;

        cout << endl;
    }

    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i<<" "<<i+2<<" "<<i+1<<" "<<i+3;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n==1) cout<<1<<endl<<1;
	else
	if(n==2) cout<<1<<endl<<1;
	else
	if(n==3) cout<<2<<endl<<1<<" "<<3;
	else
	if(n>3) {
		cout<<n<<endl;
		for(i=2;i<=n;i+=2)
		cout<<i<<" ";
		for(i=1;i<=n;i+=2)
		cout<<i<<" ";
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i+2<<" "<<i<<" "<<i+1<<" "<<i+3;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i+2<<" "<<i<<" "<<i+3<<" "<<i+1;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i+2<<" "<<i<<" "<<i+3<<" "<<i+1;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else if(n==1) cout<<1<<endl<<1;
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i+2<<" "<<i<<" "<<i+3<<" "<<i+1;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cstring>
using namespace std;
int main() {
	long long i,j,k,n,t=0;
	cin>>n;if(n==2) cout<<1<<endl<<1;
	else
	if(n%2==0) {cout<<n<<endl;
		for(i=1;i<=n/2;i++){
			if(n/2-1==i) {
				cout<<i+2<<" "<<i<<" "<<i+3<<" "<<i+1;
				break;
				}
			else cout<<i<<" "<<n+1-i<<" ";
		}
	}
	else if(n==1) cout<<1<<endl<<1;
	else {cout<<n/2+1<<endl;;
		for(i=1;i<=n/2;i++){
			cout<<i<<" "<<n+1-i<<" ";
		}
	}
//	system("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;

    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<n; i+=2)
       cout<<i<<" ";
       for (i=2; i<n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;

    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;
    if (n==1)
    cout<<1<<endl<<1<<endl;
    else
    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;
    if (n==1 || n==2)
    cout<<1<<endl<<1<<endl;
    else
    if (n==3)
    cout<<2<<endl<<"1 3"<<endl;
    else
    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=n-1; i>0; i-=2)
       cout<<i<<" ";
       for (i=n; i>0; i-=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n<<endl;
       for (i=n; i>0; i-=2)
       cout<<i<<" ";
       for (i=n-1; i>0; i-=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;

    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;
    if (n==1 || n==2)
    cout<<1<<endl<<1<<endl;
    else
    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include<iostream>
using namespace std;
int n,a[5001],i;
int main()
{
    for (i=1; i<=5000; i++)
    a[i]=i;
    cin>>n;
    if (n==1 || n==2)
    cout<<1<<endl<<1<<endl;
    else
    if (n==3)
    cout<<2<<endl<<1 3<<endl;
    else
    if (n%2==0)
    {
       cout<<n<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
       for (i=2; i<=n; i+=2)
       cout<<i<<" ";
    }
    else
    {
       cout<<n-1<<endl;
       for (i=1; i<=n; i+=2)
       cout<<i<<" ";
    }
    cout<<endl;
    //system ("pause");
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	cout<<rn<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<rn;i+=2){
		cout<<" "<<IntToString(i);
	}
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	if(i1==1){
		cout<<1<<endl<<1;
		return 0;
	}
	if(i1==2){
		cout<<1<<endl<<1;
		return 0;
	}
	if(i1==3){
		cout<<2<<endl<<1<<" "<<3;
		return 0;
	}
	if(i1==4){
		cout<<4<<endl<<3<<" "<<1<<" "<<4<<" "<<2;
		return 0;
	}
	cout<<rn<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<=rn;i+=2){
		cout<<" "<<IntToString(i);
	}
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	cout<<rn<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<=rn;i+=2){
		if(i1==3) break;
		cout<<" "<<IntToString(i);
	}
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	cout<<rn<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<=rn;i+=2){
		cout<<" "<<IntToString(i);
	}
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	if(i1==1){
		cout<<1<<endl<<1;
		return 0;
	}
	if(i1==2){
		cout<<1<<endl<<1;
		return 0;
	}
	if(i1==3){
		cout<<2<<endl<<1<<" "<<3;
		return 0;
	}
	if(i1==4){
		cout<<4<<endl<<3<<" "<<1<<" "<<4<<" "<<2;
		return 0;
	}
	cout<<i1<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<=rn;i+=2){
		cout<<" "<<IntToString(i);
	}
}


#include <iostream>
#include <sstream>
using namespace std;
int i1,rn;
string IntToString (int a)
{
    ostringstream temp;
    temp<<a;
    return temp.str();
}
main(){
	cin>>i1;
	rn=i1/2*2;
	if(i1==1){
		cout<<1<<endl<<1;
		return 0;
	}
	if(i1==2){
		cout<<1<<endl<<1;
	}
	if(i1==3){
		cout<<2<<endl<<1<<" "<<3;
	}
	if(i1==4){
		cout<<4<<endl<<3<<" "<<1<<" "<<4<<" "<<2;
	}
	cout<<rn<<(!rn ? "":"\n");
	for(int i=1;i<=i1;i+=2){
		cout<<(i==1 ? IntToString(1):" "+IntToString(i));
	}
	for(int i=2;i<=rn;i+=2){
		cout<<" "<<IntToString(i);
	}
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
 if(n<=2)cout<<1<<endl;
 else if(n==3)cout<<2<<endl<<1<<" "<<3<<endl;
 else if(n==4)cout<<4<<endl<<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<<"\n";

    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;

vector<int>x;
for(int i=0;i<n;i++)
{
    x.push_back((i+1));
}
for(int i=0;i<x.size();i++)
{

    for(int j=i+1;j<x.size();j++)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j-1]);
            break;
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
    if(i>0){
     for(int j=i-1;j>=0;j--)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j+1]);
            break;
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
    }

}
vector<int>res;
for(int i=0;i<x.size();i++)
{
    if(i==0){res.push_back(x[i]) ; continue;}
    if(abs(x[i]-x[i-1])>1)
    {
        res.push_back(x[i]);
    }
}
cout<<res.size()<<endl;
for(int i=0;i<res.size();i++)cout<<res[i]<<" ";
    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
vector<int>x;
for(int i=0;i<n;i++)
{
    x.push_back((i+1));
}
for(int i=0;i<x.size();i++)
{

    for(int j=i+1;j<x.size();j++)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j-1]);
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
}
vector<int>res;
for(int i=0;i<x.size();i++)
{
    if(i==0){res.push_back(x[i]) ; continue;}
    if(abs(x[i]-x[i-1])>1)
    {
        res.push_back(x[i]);
    }
}
cout<<res.size()<<endl;
for(int i=0;i<res.size();i++)cout<<res[i]<<" ";
    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
 if(n<=2)cout<<1<<endl<<1;
 else if(n==3)cout<<2<<endl<<1<<" "<<3<<endl;
 else if(n==4)cout<<4<<endl<<3<<" "<<1<<" "<<4<<" "<<2<<endl;
 else if(n>4)
 {
     cout<<n<<endl;
     for(int i=1;i<=n;i+=2)cout<<i<<" ";
     for(int i=2;i<=n;i+=2)cout<<i<<" ";
 }
// cout<<"\n";

    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
if(n==1)
{
    cout<<0<<endl;
    return 0;
}
vector<int>x;
for(int i=0;i<n;i++)
{
    x.push_back((i+1));
}
for(int i=0;i<x.size();i++)
{

    for(int j=i+1;j<x.size();j++)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j-1]);
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
}
vector<int>res;
for(int i=0;i<x.size();i++)
{
    if(i==0){res.push_back(x[i]) ; continue;}
    if(abs(x[i]-x[i-1])>1)
    {
        res.push_back(x[i]);
    }
}
cout<<res.size()<<endl;
for(int i=0;i<res.size();i++)cout<<res[i]<<" ";
    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
vector<int>x;
for(int i=0;i<n;i++)
{
    x.push_back((i+1));
}
for(int i=0;i<x.size();i++)
{
    for(int j=i+1;j<x.size();j++)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j-1]);
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
if(i>0 && abs(x[i]-x[i-1])==1)
{
      for(int j=i-1;j>=0;j--)
    {
        if(abs(x[i]-x[j])>1)
        {
            swap(x[j],x[j+1]);
            //cout<<x[j]<<" "<<x[j+1]<<"  A "<<endl;
        }
    }
}
}
vector<int>res;
for(int i=0;i<x.size();i++)
{
    if(i==0){res.push_back(x[i]) ; continue;}
    if(abs(x[i]-x[i-1])>1)
    {
        res.push_back(x[i]);
    }
}
cout<<res.size()<<endl;
for(int i=0;i<res.size();i++)cout<<res[i]<<" ";
    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
 if(n<=2)cout<<1<<endl;
 if(n==3)cout<<2<<endl<<1<<" "<<3<<endl;
 if(n==4)cout<<4<<endl<<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<<"\n";

    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intialize(a)  memset(a,0,sizeof(a));
#define I  int
#define F  float
#define D  double
#define S  string
#define C  char
#define END  return 0;
#define SORT(v)  sort(v.begin(),v.end())
#define RSORT(v) sort(v.rbegin(),v.rend())
#define SZ(X) (int)(X).size()
typedef long long ll;
typedef vector<ll> integr;
typedef vector<char> character;
typedef vector <string> strings;
//---------------------------------------
int main()
{
int n;
cin>>n;
 if(n<=2)cout<<1<<endl;
 else if(n==3)cout<<2<<endl<<1<<" "<<3<<endl;
 else if(n==4)cout<<4<<endl<<3<<" "<<1<<" "<<4<<" "<<2<<endl;
 else if(n>4)
 {
     cout<<n<<endl;
     for(int i=1;i<=n;i+=2)cout<<i<<" ";
     for(int i=2;i<=n;i+=2)cout<<i<<" ";
 }
// cout<<"\n";

    return 0;
}
/*
bool isp (long long  x)
{
    if (x%2==0&&x!=2 || x==1)return false;
    for (long long  i=3; i*i<=x; i+=2)
    {
        if (x%i==0)return false;
    }
    return true;
}
//========================
cout.setf(ios::fixed);
cout.precision(10);
//==========================
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {

     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1"; return 0; }
     if (n == 4) { cout<<"2\n1 3\n";  return 0; }
     else {
            cout<<n<<endl;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3";  return 0; }
           else {
           cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

 //   getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {
     //  cout<<n<<endl;
     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1";  return 0; }
     if (n == 4) { cout<<"2\n1 3\n"; return 0; }
     else {
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3"; return 0; }
           else {
          // cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

 //   getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {

     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1"; getch(); return 0; }
     if (n == 4) { cout<<"2\n1 3\n"; getch(); return 0; }
     else {
            cout<<n<<endl;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3"; getch(); return 0; }
           else {
           cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

  //  getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {

     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1";  return 0; }
     if (n == 4) { cout<<"4\n3 1 4 2\n";  return 0; }
     else {
            cout<<n<<endl;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3";  return 0; }
           else {
           cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

    //getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {
       cout<<n<<endl;
     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1"; return 0; }
     if (n == 4) { cout<<"2\n1 3\n"; return 0; }
     else {
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3"; return 0; }
           else {
           cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

   // getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {

     //  int a = n/2 + 2;
     if (n == 2) {cout<<"1\n1";  return 0; }
     if (n == 4) { cout<<"3\n1 4 3\n";  return 0; }
     else {
            cout<<n<<endl;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";
       }

    } else {
           if (n == 3) { cout<<"2\n1 3";  return 0; }
           else {
           cout<<n<<endl;
     //  int a = n/2 + 2;
       for (i = 1; i <= n; i++) if (i%2 != 0) cout<<i<< " ";
       for (i = 1; i <= n; i++) if (i%2 == 0) cout<<i<< " ";

       }
    }

   // getch();
    return 0;
}


/* Abhiruchi Gupta */
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <climits>
#include <stack>
#include <queue>
#include <set>
//#include <conio.h>
using namespace std;
int main()
{
    int n, i;
    cin>>n;
    if (n%2 == 0) {
       cout<<n<<endl;
       for (i = 1; i < n/2; i++) {
           cout<< i << " "<< n - i << " ";
       }
       cout<<n/2 << " " << n << endl;
    } else {
           cout<<n-1<<endl;
           for (i = 0; i < n/2; i++) {
               cout<<i+ 1 << " " << n - i << " ";
           }
    }

  //  getch();
    return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	int b = n;
	if(n == 1) {
		cout << 1;
		return 0;
	}
	while(a < b) {
		cout << a << " ";
		a++;
		cout << b << " ";
		b--;
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	while(a <= n) {
		cout << a << " ";
		a += 2;
	}

	a = 2;
	if(a != n - 1)
	while(a <= n) {
		cout << a << " ";
		a += 2;
	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	int b = n;

	while(a < b) {
		cout << a << " ";
		a++;
		cout << b << " ";
		b--;
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	if(n < 5) {
		if(n < 3) cout << 1 << endl << 1;
		if(n == 3) cout << 2 << endl << "1 3";
		if(n == 4) cout << 4 << endl << "3 1 4 2";
	} else {
		vector<int> s;
		int a = 1;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		a = 2;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		cout << s.size() << endl;
		for(int i = 0; i < s.size(); i++) {
			cout << s[i] << " ";
		}
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> ans;

	int a = 1;
	int b = n;

	if(n == 2) {
		cout << 1 << endl << 1;
		return 0;
	}

	while(a < b) {
		ans.push_back(a);
		a++;
		if(b != a) ans.push_back(b);
		b--;
	}

	vector<int> s;
	a = 1;
	while(a <= n) {
		s.push_back(a);
		a += 2;
	}

	if(a - 2 != 3) {
		a = 2;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}
	}

	if(ans.size() > s.size()) {
		cout << ans.size() << endl;
		for(int i = 0; i < ans.size(); i++) {
			cout << ans[i] << " ";
		}
	} else {
		cout << s.size() << endl;
		for(int i = 0; i < s.size(); i++) {
			cout << s[i] << " ";
		}
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

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

		vector<int> s;
		int a = 1;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		a = 2;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		cout << s.size() << endl;
		for(int i = 0; i < s.size(); i++) {
			cout << s[i] << " ";
		}
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	vector<int> ans;
	while(a <= n) {
		ans.push_back(a);
		a += 2;
	}

	a -= 2;
	if(2 != a - 1) {
		a = 2;
		while(a <= n) {
			ans.push_back(a);
			a += 2;
		}

	}
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++) {
		cout << ans[i] << " ";
	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	if(n < 5) {
		if(n < 3) cout << 1 << endl << 1;
		if(n == 3) cout << 2 << endl << "1 3";
		if(n == 4) cout << 3 << endl << "3 1 4 2";
	} else {
		vector<int> s;
		int a = 1;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		a = 2;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		cout << s.size() << endl;
		for(int i = 0; i < s.size(); i++) {
			cout << s[i] << " ";
		}
	}

	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	vector<int> ans;
	while(a <= n) {
		ans.push_back(a);
		a += 2;
	}

	a = 2;
	if(a != n - 1)
	while(a <= n) {
		ans.push_back(a);
		a += 2;
	}

	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++) {
		cout << ans[i] << " ";
	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	int a = 1;
	vector<int> ans;
	while(a <= n) {
		ans.push_back(a);
		a += 2;
	}

	a -= 2;
	if(2 != a - 1) {
		a = 2;
		while(a <= n) {
			ans.push_back(a);
			a += 2;
		}

	}

	a = 1;
	int b = n;
	vector<int> ans2;

	while(a < b) {
		ans2.push_back(a);
		a++;
		ans2.push_back(b);
		b--;
	}

	if(ans2.size() > 1) {
		if(abs(ans2[ans2.size() - 1] - ans2[ans2.size() - 2]) == 1) {
			ans2.pop_back();
		}
	}

	if(ans2.size() > ans.size()) {
		cout << ans2.size() << endl;
		for(int i = 0; i < ans2.size(); i++) {
			cout << ans2[i] << " ";
		}
	} else {
		cout << ans.size() << endl;
		for(int i = 0; i < ans.size(); i++) {
			cout << ans[i] << " ";
		}
	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <ctime>
#include <queue>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;

	if(n < 5) {
		if(n < 3) cout << 1 << endl << 1;
		if(n == 3) cout << 2 << endl << "1 3";
		if(n == 4) cout << 3 << endl << "1 4 2";
	} else {
		if(n < 1000) {
			cout << "sfsefsf";
			return 0;
		}
		vector<int> s;
		int a = 1;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		a = 2;
		while(a <= n) {
			s.push_back(a);
			a += 2;
		}

		cout << s.size() << endl;
		for(int i = 0; i < s.size(); i++) {
			cout << s[i] << " ";
		}
	}

	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 2)
		cout << "1\t" << "3\n";
	else if (count == 1)
		cout << "1\t";
	else if (count == 1)
		cout << "3\1" << "1\t" << "4\t" << "2\t";
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 2)
		cout << "1\t" << "3\n";
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}
	system("pause");
}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 2)
		cout << "1\t" << "3\n";
	else if (count == 1)
		cout << "1\t";
	else if (count == 1)
		cout << "1\1" << "3\t" << "2\t" << "4\t";
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 1)
		cout << count;
	else if (count == 2)
		cout << "1\t" << "3\n";

	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 2)
		cout << "1\t" << "3\n";
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 2)
		cout << "1\t" << "3\n";
	else if (count == 1)
		cout << "1\t";
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n, count ;
	int arr[5000];
	cin >> n;
	if (n == 1 || n == 2)
		count = 1;
	else if (n == 3)
		count = 2;
	else
		count = n;
	cout << count<<"\n";
	if (count == 1)
		cout << count;
	else if (count == 2)
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
	}
	else if (count==4)
	for (int i = 1; i <=count; i++)
	{
		if (i == 1)
			cout << i + 2 << "\t";
		else if (i == 2)
			cout << i - 1 << "\t";
		else if (i == 3)
			cout << i + 1 << "\t";
		else
			cout << "2";
	}
	else
	{
		for (int i = 1; i <= n; i++)
		if (i % 2 == 1)
			cout << i << "\t";
		for (int i = 1; i <= n; i++)
		if (i % 2 == 0)
			cout << i << "\t";
	}

}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("2 4 1 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("3\n");
		printf("1 4 2 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("1\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("2 4 1 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("0\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("1 4 2 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("1\n");
		printf("1\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("2 4 1 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);
	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("1 4 2 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	for(int i=1;i<cnt;i++)
	printf("%d ",a[i]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("1 4 2 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	printf("%d\n",n);
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cmath>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

typedef long long LL;
const int INF = (1<<30)-1;
const int mod=1000000007;
const int maxn=100005;
int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		printf("1\n1\n");
		return 0;
	}
	if(n==2){
		printf("0\n");
		return 0;
	}
	if(n==3){
		printf("2\n");
		printf("1 3\n");
		return 0;
	}
	if(n==4){
		printf("4\n");
		printf("1 4 2 3\n");
		return 0;
	}
	int cnt=1;
	if(n>=5){
		for(int i=1;i<=n;i++){
			if(i%2) a[cnt++]=i;
		}

		for(int i=1;i<=n;i++)
		if(i%2==0) a[cnt++]=i;
	}
	for(int i=1;i<cnt-1;i++)
	printf("%d ",a[i]);

	printf("%d\n",a[cnt-1]);
}


#include <stdio.h>
#include <algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int n,x;
	cin>>n;
	x=n;
	if(n!=3)
		cout<<n<<endl;
	else
		x=n-2,cout<<n-1<<endl;
    for(int i=n-1;i>=1;i-=2)
		cout<<i<<" ";
	for(int i=x;i>=1;i-=2)
		cout<<i<<" ";
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int n,x,v=1;
	cin>>n;
	x=n;
	if(n!=3)
		cout<<n<<endl;
	else
		v=2,cout<<n-1<<endl;
    for(int i=n-1;i>=v;i-=2)
		cout<<i<<" ";
	for(int i=x;i>=1;i-=2)
		cout<<i<<" ";
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int n,x,v=1;
	cin>>n;
	x=n;
	if(n==2)
	{
		cout<<1<<endl<<1;
		return 0;
	}
	if(n==3)
	{
		cout<<2<<endl<<"1 3";
		return 0;
	}
	cout<<n<<endl;
    for(int i=2;i<=n;i+=2)
		cout<<i<<" ";
	for(int i=1;i<=n;i+=2)
		cout<<i<<" ";
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int n,x,v=1;
	cin>>n;
	x=n;
	if(n==2)
	{
		cout<<1<<endl<<1;
		return 0;
	}
	if(n==3)
	{
		cout<<1<<endl<<"1 3";
		return 0;
	}
	cout<<n<<endl;
    for(int i=2;i<=n;i+=2)
		cout<<i<<" ";
	for(int i=1;i<=n;i+=2)
		cout<<i<<" ";
  return 0;
}


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


#include<stdio.h>

int main()
{
    int m,t,r,i=1,j=0,p=1,q=1;
    scanf("%d %d %d",&m,&t,&r);
    int ara[m],candle[1001];
    for(i=0;i<m;i++){
        scanf("%d",&ara[i]);
    }
    for(j=r;j>0;j--){
        if(ara[0]-j+t>=ara[0]){
            candle[p]=ara[0]-j+t;
            p++;
        }
        else{
            printf("-1");
            return 0;
        }
    }
    for(i=1;i<m;i++){
        for(j=p-1;j>=p-r;j--){
            if(candle[j]>=ara[i]){
                continue;
            }
            else{
                candle[p]=ara[i]-q+t;
                p++;q++;
            }
        }
    }
    printf("%d",p-1);
    return 0;
}


#include<stdio.h>

int main()
{
    int m,t,r,i=1,j=0,p=1,q=1;
    scanf("%d %d %d",&m,&t,&r);
    int ara[m],candle[1001];
    for(i=0;i<m;i++){
        scanf("%d",&ara[i]);
    }
    for(j=r;j>0;j--){
        if(ara[0]-j+t>ara[0]){
            candle[p]=ara[0]-j+t;
            p++;
        }
        else{
            printf("-1");
            return 0;
        }
    }
    for(i=1;i<m;i++){
        for(j=p-1;j>=p-r;j--){
            if(candle[j]>=ara[i]){
                continue;
            }
            else{
                candle[p]=ara[i]-q+t;
                p++;q++;
            }
        }
    }
    printf("%d",p-1);
    return 0;
}


#include<stdio.h>
int candle[10001];
void merge(int min,int mid,int max)
{
    int tmp[1000];
    int i,j,k,m;
    j=min;
    m=mid+1;
    for(i=min;j<=mid&&m<=max;i++){
        if(candle[j]<=candle[m]){
            tmp[i]=candle[j];
            j++;
        }
        else{
            tmp[i]=candle[m];
            m++;
        }
    }
    if(j>mid){
        for(k=m; k<=max; k++){
            tmp[i]=candle[k];
            i++;
        }
    }
    else{
        for(k=j; k<=mid; k++){
            tmp[i]=candle[k];
            i++;
        }
    }
    for(k=min; k<=max; k++)
         candle[k]=tmp[k];
}
void part(int min,int max)
{
    int mid;
    if(min<max){
        mid=(min+max)/2;
        part(min,mid);
        part(mid+1,max);
        merge(min,mid,max);
    }
}
int main()
{
    int m,t,r,i=1,j=0,p=1,q=1,c;
    scanf("%d %d %d",&m,&t,&r);
    int ara[m];
    for(i=0;i<m;i++){
        scanf("%d",&ara[i]);
    }
    for(j=r;j>0;j--){
        if(ara[0]-j+t>=ara[0]){
            candle[p]=ara[0]-j+t;
            p++;
            //can++;
        }
        else{
            printf("-1");
            return 0;
        }
    }
    for(i=1;i<m;i++){
        c=p;
        for(j=c-r;j<c;j++){
            if(candle[j]<ara[i]){
                candle[p]=ara[i]-q+t;
                part(0,p);
                p++;q++;
            }
        }
        q=1;
    }
    printf("%d",p-1);
    return 0;
}


#include <stdio.h>
int w[1000], lig[1000];

int main()
{
    #ifdef LOCAL
    freopen("data.in", "r", stdin);
    #endif
    int m, t, r, i, j, k, l, need, count, prevs, preve;
    while(scanf("%d%d%d", &m, &t, &r) != EOF)
    {
        count = 0;
        for(i = 0; i < 400; i++)
        {
            w[i] = 0; lig[i] = 0;
        }
        for(i = 0; i < m; i++)
            scanf("%d", &w[i]);
        for(i = 0; i < m; i++)
        {
            //printf("------j=w[%d]=%d------\n", i, w[i]);
            j = w[i];
            need = r - lig[j];
            //printf("lig[%d]=%d,need=%d\n", j, lig[j], need);
            for(k = 1; k <= need; k++)
            {
                    prevs = j - k + 1;
                    if(prevs < 0) prevs = 0;
                    preve = j - k + t;
                    for(l = prevs; l <= preve; l++)
                    lig[l]++;
                    count++;
            }
            if(lig[j] < r)
            {
                count = -1;break;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}


#include <stdio.h>
int w[1000], lig[1000];

int main()
{
    #ifdef LOCAL
    freopen("data.in", "r", stdin);
    #endif
    int m, t, r, i, j, k, need, count;
    while(scanf("%d%d%d", &m, &t, &r) != EOF)
    {
        count = 0;
        for(i = 0; i < 400; i++)
        {
            w[i] = 0; lig[i] = 0;
        }
        //printf("1\n");
        for(i = 0; i < m; i++)
            scanf("%d", &w[i]);
        for(i = 0; i < m; i++)
        {
            j = w[i];
            need = r - lig[j];
            //printf("1:j=%d,lig=%d,r=%d,need=%d\n", j, lig[j], r, need);
            for(k = 1; k <= need; k++)
            {
                    lig[j - k + 1] += 1;
                    lig[j - k + t + 1] -= 1;
                    count++;
                    //printf("2:j=%d,lig=%d,r=%d,need=%d\n", j, lig[j], r, need);
            }
            if(need > 0)
                for(k = j - need + 1; k <= j + t + 1; k++)
                {
                    lig[k] =  lig[k] + lig[k-1];
                    //printf("lig[%d]=lig[%d]+lig[%d]=%d\n", k, k, k-1, lig[k]);
                }
            /*for(k = j - need + 1; k <= j + t + 1; k++)
            {
                printf("lig[%d]=%d\n", k, lig[k]);
            }*/
            if(lig[j] < r)
            {
                count = -1;break;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}


#include <stdio.h>
int w[400], lig[400];

int main()
{
    #ifdef LOCAL
    freopen("data.in", "r", stdin);
    #endif
    int m, t, r, i, j, k, need, count;
    while(scanf("%d%d%d", &m, &t, &r) != EOF)
    {
        count = 0;
        for(i = 0; i < 400; i++)
        {
            w[i] = 0; lig[i] = 0;
        }
        //printf("1\n");
        for(i = 0; i < m; i++)
            scanf("%d", &w[i]);
        for(i = 0; i < m; i++)
        {
            j = w[i];
            need = r - lig[j];
            //printf("1:j=%d,lig=%d,r=%d,need=%d\n", j, lig[j], r, need);
            for(k = 1; k <= need; k++)
            {
                    lig[j - k + 1] += 1;
                    lig[j - k + t + 1] -= 1;
                    count++;
                    //printf("2:j=%d,lig=%d,r=%d,need=%d\n", j, lig[j], r, need);
            }
            if(need > 0)
                for(k = j - need + 1; k <= j + t + 1; k++)
                {
                    lig[k] =  lig[k] + lig[k-1];
                    //printf("lig[%d]=lig[%d]+lig[%d]=%d\n", k, k, k-1, lig[k]);
                }
            /*for(k = j - need + 1; k <= j + t + 1; k++)
            {
                printf("lig[%d]=%d\n", k, lig[k]);
            }*/
            if(lig[j] < r)
            {
                count = -1;break;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}


#include <stdio.h>
int w[1000], lig[1000];

int main()
{
    #ifdef LOCAL
    freopen("data.in", "r", stdin);
    #endif
    int m, t, r, i, j, k, need, count, prev;
    while(scanf("%d%d%d", &m, &t, &r) != EOF)
    {
        count = 0;
        for(i = 0; i < 400; i++)
        {
            w[i] = 0; lig[i] = 0;
        }
        for(i = 0; i < m; i++)
            scanf("%d", &w[i]);
        for(i = 0; i < m; i++)
        {
            j = w[i];
            need = r - lig[j];
            for(k = 1; k <= need; k++)
            {
                    prev = j - k + 1;
                    if(prev < 0) prev = 0;
                    if(j - k + t + 1 >0)lig[prev] += 1;
                    prev = j - k + t + 1;
                    if(prev > 0)lig[prev] -= 1;
                    count++;
            }
            if(need > 0)
            {
                prev = j - need + 1;
                if(prev <= 0) prev = 1;
                for(k = prev; k <= j + t + 1; k++)
                {
                    lig[k] =  lig[k] + lig[k-1];
                }
            }
            if(lig[j] < r)
            {
                count = -1;break;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}


/*288*/
#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w,j,k;
	int x,ans=0;
	int can[301]={0};
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}
	for(i=1;i<=300;i++)
	{
		if(mem[i])
		{
			int x,count=0;
			for(k=1;k<=r;k++)
			{
				if(!can[k]){count++;can[k]=t-count+1;}
			}

			ans+=count;

		}

		for(j=1;j<=r;j++){if(can[j])can[j]--;}

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


/*288*/
#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w,j,k;
	int x,ans=0;
	int can[301];
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=1;i<=r;i++)can[i]=0;
	scanf("%d",&w);
	mem[w]=1;
	j=w;
	for(i=1;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}
	for(i=j;i<=w;i++)
	{
		if(mem[i])
		{
			int count=0;
			for(k=1;k<=r;k++)
			{
				if(!can[k]){count++;can[k]=t-count+1;}
			}
			ans+=count;
		}

		for(j=1;j<=r;j++){if(can[j])can[j]--;}

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


#include<stdio.h>

int main()
{
	int m,r,t;
	int i,w,min=301,max=0;
	int x,ans;
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		min=(min<w)?min:w;
		max=(max>w)?max:w;
	}
	x=max-1-min+r+1;
	ans=(x/t) + ((x%t)<r)?(x%t):r;
	printf("%d\n",ans);
	return 0;
}


#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w;
	int x,ans=0;
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}

	for(i=1;i<=300;)
	{
		if(mem[i])
		{
			ans+=r;
			i+=(t-r+1);
		}
		else i++;
	}
	printf("%d\n",ans);
	return 0;
}


#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w,j,k;
	int x,ans=0;
	int can[301]={0};
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}
	for(i=1;i<=300;i++)
	{
		for(j=1;j<=r;j++)if(can[j])can[j]--;
		if(mem[i])
		{
			int x;
			for(k=1;k<=r;k++)
			{
				if(can[k])break;
			}
			for(x=1;x<k;x++)can[x]=t-k+x;
			ans+=k-1;
		}
	}
	printf("%d\n",ans);
	return 0;
}


/*288*/
#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w,j,k;
	int x,ans=0;
	int can[301];
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=1;i<=r;i++)can[i]=0;
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}
	for(i=1;i<=w;i++)
	{
		if(mem[i])
		{
			int count=0;
			for(k=1;k<=r;k++)
			{
				if(!can[k]){count++;can[k]=t-count+1;}
			}
			ans+=count;
		}

		for(j=1;j<=r;j++){if(can[j])can[j]--;}

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


/*288*/
#include<stdio.h>

int mem[301];

int main()
{
	int m,r,t;
	int i,w,j,k;
	int x,ans=0;
	int can[301]={0};
	scanf("%d %d %d",&m,&t,&r);
	if(r>t)
	{
		printf("-1\n");
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d",&w);
		mem[w]=1;
	}
	for(i=1;i<=300;i++)
	{
		if(mem[i])
		{
			int x,count=0;
			for(k=1;k<=r;k++)
			{
				if(!can[k]){count++;can[k]=t-count;}
			}

			ans+=count;

		}

		for(j=1;j<=r;j++){if(can[j])can[j]--;}

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


#include<stdio.h>
int stack[90005];
int arr[305];
int main()
{
      int m,t,r,i,flag = 0;
      scanf("%d%d%d",&m,&t,&r);
      for(i=0;i<m;i++)
      scanf("%d",&arr[i]);
      int count = 0,l = 0,f = r-1;
      for(i=0;i<r;i++)
      stack[i] = arr[0]-r+i;
      count = r;
      int j;
      if(t<r)
      flag=1;
      else
      {
      for(i=1;i<m;i++)
      {
            int tmp = 0;
            while(stack[l]+t<=arr[i]&&l<=f)
            {
                  tmp++;
                  l++;
            }
            if(arr[i]-tmp<=stack[f])
            {
                  flag=1;
                  break;
            }
            count +=tmp;
            for(j=1;j<=tmp;j++)
            {
                 stack[f+j] = arr[i] - tmp + j - 1;
            }
            f = f+tmp;
      }
      }
      if(flag==1)
      printf("-1\n");
      else
      printf("%d\n",count);
      return 0;
}