#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include<set>
#include<map>
#include<queue>

#define MAXN 1005
#define inf 0x3f3f3f3f
typedef long long ll ;
const double eps =1e-8;

using namespace std;
int a[MAXN];
int b[MAXN];
int c[MAXN];
int d[MAXN];
ll n,m;
int ans;

int main()
{
    //freopen("out.txt", "w", stdout);
    int t,cases = 0;
    scanf("%I64d %I64d",&m,&n);
    if(m >= n){
        if(n > 1){
            int pp = 0;
            ll ans = -1*inf;
            ll res = 0;
            for(int i = 0 ; i < n ; i++){
                int p = m-i;
                int q = n;
                res = -1*(q/(i+2))*(q/(i+2)) * (i+2-q%(i+2)) - (q/(i+2)+1)*(q/(i+2)+1) * (q%(i+2)) ;
                res += p*p+i;
                if(res > ans){
                    ans = res;
                    pp = i;
                }
            }

            int p = m-pp;
            int q = n;
            printf("%I64d\n",ans);
            int r = q%(pp+2);
            int l = pp+2-q%(pp+2);
            l--;

            for(int j = 0 ; j < q/(pp+2) ; j++)
                printf("x");
            for(int j = 0 ; j < m-pp ; j++)
                printf("o");
            if(r != 0){
                r--;
                while(l--){
                    for(int j = 0 ; j < q/(pp+2) ; j++)
                        printf("x");
                    printf("o");
                }
                while(r--){
                    for(int j = 0 ; j < q/(pp+2)+1 ; j++)
                        printf("x");
                    printf("o");
                }
                for(int j = 0 ; j < q/(pp+2)+1 ; j++)
                    printf("x");
            }
            else{
                l--;
                while(l--){
                    for(int j = 0 ; j < q/(pp+2) ; j++)
                        printf("x");
                    printf("o");
                }
                for(int j = 0 ; j < q/(pp+2) ; j++)
                    printf("x");
            }

            printf("\n");

            /*
            for(int j = 0 ; j < n/2 ; j++)
                printf("x");
            for(int j = 0 ; j < m ; j++)
                printf("o");
            for(int j = 0 ; j < n-n/2 ; j++)
                printf("x");
            printf("\n");
            */
        }
        else if(n == 1){
            printf("%I64d\n",m*m-n);
            for(int j = 0 ; j < m ; j++)
                printf("o");
            printf("x\n");
        }
        else{
            printf("%I64d\n",m*m);
            for(int j = 0 ; j < m ; j++)
                printf("o");
            printf("\n");

        }
    }
    else{
        if(m > 1){

            /*
            for(int i = 0 ; i < m ; i++)
                printf("xo");
            for(int i = 0 ; i < n-m ; i++)
                printf("x");
            printf("\n");
            */

            int pp = 0;
            ll ans = -1*inf;
            ll res = 0;
            for(int i = 0 ; i < n ; i++){
                int p = m-i;
                int q = n;
                res = -1*(q/(i+2))*(q/(i+2)) * (i+2-q%(i+2)) - (q/(i+2)+1)*(q/(i+2)+1) * (q%(i+2)) ;
                res += p*p+i;
                if(res > ans){
                    ans = res;
                    pp = i;
                }
            }

            int p = m-pp;
            int q = n;
            printf("%I64d\n",ans);
            int r = q%(pp+2);
            int l = pp+2-q%(pp+2);
            l--;

            for(int j = 0 ; j < q/(pp+2) ; j++)
                printf("x");
            for(int j = 0 ; j < m-pp ; j++)
                printf("o");
            if(r != 0){
                r--;
                while(l--){
                    for(int j = 0 ; j < q/(pp+2) ; j++)
                        printf("x");
                    printf("o");
                }
                while(r--){
                    for(int j = 0 ; j < q/(pp+2)+1 ; j++)
                        printf("x");
                    printf("o");
                }
                for(int j = 0 ; j < q/(pp+2)+1 ; j++)
                    printf("x");
            }
            else{
                l--;
                while(l--){
                    for(int j = 0 ; j < q/(pp+2) ; j++)
                        printf("x");
                    printf("o");
                }
                for(int j = 0 ; j < q/(pp+2) ; j++)
                    printf("x");
            }

            printf("\n");

            /*
            ll ans = 0;
            int p = n;
            for(int i = 0 ; i < m ; i++){
                ans -= (p/(m-i+1))*(p/(m-i+1));
                p -= p/(m-i+1);
            }
            ans -= p*p;
            ans += m;
            printf("%I64d\n",ans);

            for(int i = 0 ; i < m ; i++){
                for(int j  =0 ; j < n/(m-i+1) ; j++)
                    printf("x");
                printf("o");
                n -= n/(m-i+1);
            }
            for(int i = 0 ; i < n ; i++)
                printf("x");
            printf("\n");

            for(int j = 0 ; j < n/2 ; j++)
                printf("x");
            for(int j = 0 ; j < m ; j++)
                printf("o");
            for(int j = 0 ; j < n-n/2 ; j++)
                printf("x");
            printf("\n");
            */

        }
        else if(m == 1){
            printf("%I64d\n",1-(n/2)*(n/2) - (n-n/2)*(n-n/2));
            for(int j = 0 ; j < n/2 ; j++)
                printf("x");
            printf("o");
            for(int j = 0 ; j < n-n/2 ; j++)
                printf("x");
            printf("\n");
        }
        else{
            printf("%I64d\n",-1*n*n);
            for(int j = 0 ; j < n ; j++)
                printf("x");
            printf("\n");

        }
    }
    return 0;
}


#include<stdio.h>
#define ll long long
ll min(ll a,ll b)
{
    if(a<b)
        return a;
    return b;
}
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    if(n==0)
    {
        printf("%lld\n",-m*m);
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    if(m==0)
    {
        printf("%lld\n",n*n);
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        printf("\n");
        return 0;
    }
    ll MAX=-0x3fffffff;
    ll mid=1;
    ll mm=min(n+1,m);
    printf("%lld\n",mm);
    ll ans;
    for(ll i=1;i<=mm;i++)
    {
        ll a=m/i;
        ll b=m%i;
        if(i==1)
            ans=n*n-m*m;
        else
        ans=(i-2)+(n-i+2)*(n-i+2)-(b*((a+1)*(a+1))+(i-b)*a*a);
        if(MAX<ans)
        {
            MAX=ans;
            mid=i;
        }
    }
    printf("%lld\n",MAX);
    ll a=m/mid;
    ll b=m%mid;
    if(mid==1)
    {
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    for(ll i=1;i<=mid;i++)
    {
        for(ll j=1;j<=a;j++)
        {
            printf("x");
        }
        if(i<=b)
        {
            printf("x");
        }
        if(i==1)
        {
            for(ll j=1;j<=n-(mid-2);j++)
                printf("o");
        }
        else
        {
            if(i<mid)
            {
                printf("o");
            }
        }
    }
    printf("\n");
}


#include<stdio.h>
#define ll long long
ll min(ll a,ll b)
{
    if(a<b)
        return a;
    return b;
}
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    if(n==0)
    {
        printf("%lld\n",-m*m);
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    if(m==0)
    {
        printf("%lld\n",n*n);
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        printf("\n");
        return 0;
    }
    ll MAX=-0x3fffffff;
    ll mid=1;
    ll mm=min(n+1,m);
    //printf("%lld\n",mm);
    ll ans;
    for(ll i=1;i<=mm;i++)
    {
        ll a=m/i;
        ll b=m%i;
        if(i==1)
            ans=n*n-m*m;
        else
        ans=(i-2)+(n-i+2)*(n-i+2)-(b*((a+1)*(a+1))+(i-b)*a*a);
        if(MAX<ans)
        {
            MAX=ans;
            mid=i;
        }
    }
    printf("%lld\n",MAX);
    ll a=m/mid;
    ll b=m%mid;
    if(mid==1)
    {
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    for(ll i=1;i<=mid;i++)
    {
        for(ll j=1;j<=a;j++)
        {
            printf("x");
        }
        if(i<=b)
        {
            printf("x");
        }
        if(i==1)
        {
            for(ll j=1;j<=n-(mid-2);j++)
                printf("o");
        }
        else
        {
            if(i<mid)
            {
                printf("o");
            }
        }
    }
    printf("\n");
}


#include<stdio.h>
#define ll long long
ll min(ll a,ll b)
{
    if(a<b)
        return a;
    return b;
}
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    if(n==0)
    {
        printf("%lld\n",-m*m);
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    if(m==0)
    {
        printf("%lld\n",n*n);
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        printf("\n");
        return 0;
    }
    ll MAX=0x3fffffff;
    MAX=-MAX*MAX;
    ll mid=1;
    ll mm=min(n+1,m);
    //printf("%lld\n",mm);
    ll ans;
    for(ll i=1;i<=mm;i++)
    {
        ll a=m/i;
        ll b=m%i;
        if(i==1)
            ans=n*n-m*m;
        else
        ans=(i-2)+(n-i+2)*(n-i+2)-(b*((a+1)*(a+1))+(i-b)*a*a);
        //printf("<%lld>\n",ans);
        if(MAX<ans)
        {
            MAX=ans;
            mid=i;
        }
    }
    printf("%lld\n",MAX);
    ll a=m/mid;
    ll b=m%mid;
    if(mid==1)
    {
        for(ll i=0;i<n;i++)
        {
            printf("o");
        }
        for(ll i=0;i<m;i++)
        {
            printf("x");
        }
        printf("\n");
        return 0;
    }
    for(ll i=1;i<=mid;i++)
    {
        for(ll j=1;j<=a;j++)
        {
            printf("x");
        }
        if(i<=b)
        {
            printf("x");
        }
        if(i==1)
        {
            for(ll j=1;j<=n-(mid-2);j++)
                printf("o");
        }
        else
        {
            if(i<mid)
            {
                printf("o");
            }
        }
    }
    printf("\n");
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	int a, b, i, j;
	LL Min = -(LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(b==1){
		cout << a*a-1 << endl;
		rep(i, a) cout << 'o';
		cout << 'x' << endl;
	}else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}else {
		repf(i, 1, b-1){
			LL y = b % (i+1);
			LL x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
	//	cout << ans << endl;
		LL y = b % (ans+1);
		LL x = b / (ans+1);
	//	cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}

}
int main(){
	ios::sync_with_stdio(false);
	while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	LL a, b, i, j;
	LL Min = -(LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(b==1){
		cout << a*a-1 << endl;
		rep(i, a) cout << 'o';
		cout << 'x' << endl;
	}else if(a > b - 1) {
		repf(i, 1, b-1){
			LL y = b % (i+1);
			LL x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
	//	cout << ans << endl;
		LL y = b % (ans+1);
		LL x = b / (ans+1);
	//	cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}
	else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}
	else {
	//	cout << "ok" << endl;
		repf(i, 1, a){
			LL y = b % (i+1);
			LL x = b / (i+1);
		//	cout << a*a << ' ' << x*x*2 << endl;
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			//cout << cc << endl;
			//system("pause");
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
	//	cout << ans << endl;
		LL y = b % (ans+1);
		LL x = b / (ans+1);
		//cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}
}
int main(){
	ios::sync_with_stdio(false);
	//while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	int a, b, i, j;
	long long Min = -(LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(b==1){
		cout << a*a-1 << endl;
		rep(i, a) cout << 'o';
		cout << 'x' << endl;
	}else if(a > b - 1) {
		repf(i, 1, b-1){
			int y = b % (i+1);
			int x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
		//cout << ans << endl;
		int y = b % (ans+1);
		int x = b / (ans+1);
		//cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}
	else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}
	else {
		int y = b % (a+1);
		int x = b / (a+1);
		cout << a - (x+1)*(x+1)*y - (a+1-y)*x*x << endl;
		rep(i, y){
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, a-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(j, x) cout << 'x';
		cout << endl;
	}
}
int main(){
	ios::sync_with_stdio(false);
	//while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	int a, b, i, j;
	LL Min = -(LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(b==1){
		cout << a*a-1 << endl;
		rep(i, a) cout << 'o';
		cout << 'x' << endl;
	}else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}else {
		repf(i, 1, b-1){
			LL y = b % (i+1);
			LL x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
	//	cout << ans << endl;
		LL y = b % (ans+1);
		LL x = b / (ans+1);
	//	cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}

}
int main(){
	ios::sync_with_stdio(false);
	//while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	int a, b, i, j;
	long long Min = -(LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(a > b - 1) {
		repf(i, 1, b-1){
			int y = b % (i+1);
			int x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (i+1-y)*x*x;
			if(Min < cc) Min = cc, ans = i;
		}
		cout << Min << endl;
		//cout << ans << endl;
		int y = b % (ans+1);
		int x = b / (ans+1);
		//cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}
	else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}
	else {
		int y = b % (a+1);
		int x = b / (a+1);
		cout << a - (x+1)*(x+1)*y - (a+1-y)*x*x << endl;
		rep(i, y){
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, a-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(j, x) cout << 'x';
		cout << endl;
	}
}
int main(){
	ios::sync_with_stdio(false);
	//while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define LL long long
#define rep(i,n) for(i=0;i<n;i++)
#define repf(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define clr(a,vel) memset(a,vel,sizeof(a))
#define pb push_back
#define oo 0x7fffffff
#define CV 2139062143
void solve(){
	int a, b, i, j;
	long long Min = (LL)oo<<32, ans, cc;
	//cout << Min << endl;
	cin >> a >> b;
	if( !b ){
		cout << a*a << endl;
		rep(i, a) cout << 'o';
		cout << endl;
	}else 	if(a > b - 1) {
		repf(i, 1, b-1){
			int y = b % (i+1);
			int x = b / (i+1);
			cc = (a-i+1)*(a-i+1) + (i-1) -  (x+1)*(x+1)*y - (a+1-y)*x*x;
			if(Min > cc) Min = cc, ans = i;
		}
		cout << Min << endl;
		//cout << ans << endl;
		int y = b % (ans+1);
		int x = b / (ans+1);
		//cout << y << ' ' << x << endl;
		rep(i, y) {
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, ans-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(i, a-ans) cout << 'o';
		rep(j, x) cout << 'x';
		cout << endl;
	}
	else if( !a ) {
		cout << -b*b << endl;
		rep(i, b) cout << 'x';
		cout << endl;
	}
	else {
		int y = b % (a+1);
		int x = b / (a+1);
		cout << a - (x+1)*(x+1)*y - (a+1-y)*x*x << endl;
		rep(i, y){
			rep(j, x+1) cout << 'x';
			cout << 'o';
		}
		rep(i, a-y) {
			rep(j, x) cout << 'x';
			cout << 'o';
		}
		rep(j, x) cout << 'x';
		cout << endl;
	}
}
int main(){
	ios::sync_with_stdio(false);
	//while(1)
	solve();
	//system("pause");
	return 0;
}


#include <cstdio>

using namespace std;

int main() {
    long long a,b;
    scanf("%I64d%I64d",&a,&b);
    if(a <= b) {
        printf("-%I64d\n",(b - a) * (b - a));
        for(int i = 0;i < b - a;i ++) {
            printf("x");
        }
        for(int i = 0;i < a;i ++) {
            printf("ox");
        }
        return 0;
    }
    printf("%I64d\n",a * a - (b/2) * (b/2) - (b - b/2) * (b - b/2));
    for(int i = 0;i < b/2;i ++) {
        printf("x");
    }
    for(int i = 0;i < a;i ++) {
        printf("o");
    }
    for(int i = 0;i < b - b/2;i ++) {
        printf("x");
    }
    return 0;
}


#include <cstdio>

using namespace std;

int main() {
    long long a,b;
    scanf("%I64d%I64d",&a,&b);
    if(a <= b) {
        printf("-%I64d\n",(b - a) * (b - a));
        for(int i = 0;i < b - a;i ++) {
            printf("x");
        }
        for(int i = 0;i < a;i ++) {
            printf("ox");
        }
        return 0;
    }
    printf("%I64d\n",a * a - b * b);
    for(int i = 0;i < a;i ++) {
        printf("o");
    }
    for(int i = 0;i < b;i ++) {
        printf("x");
    }
    return 0;
}


#include <cstdio>
using namespace std;

typedef long long ll;
int main() {
    ll a,b;
    scanf("%I64d%I64d",&a,&b);

    if(a == 0) {
        printf("-%I64d\n",b * b);
        for(int i = 0;i < b;i ++)
            printf("x");
        return 0;
    }
    ll max = a * a - b * b;
    int pp = 1;
    for(int p = 2;p <= a;p ++) {
        ll tmp = (a - p + 1) * (a - p + 1) + p - 1;
        int q = p + 1;
        ll num = b/q,rem = b % q;
        tmp -= rem * (num + 1) * (num + 1);
        tmp -= (q - rem) * (num * num);
        if(max < tmp) {
            max = tmp;
            pp = p;
        }
        // printf("%I64d %d\n",tmp,pp);
    }
    printf("%I64d\n",max);
    for(int i = 1;i <= pp;i ++) {
        int q = pp + 1;
        if(i <= b % q) {
            for(int prin = 1;prin <= b/q + 1;prin ++)
                printf("x");
        } else {
            for(int prin = 1;prin <= b/q;prin ++)
                printf("x");
        }

        if(i == 1) {
            for(int prin = 1;prin <= a - pp + 1;prin ++)
                printf("o");
        } else {
            printf("o");
        }
    }
    for(int i = 0;i < b/(pp + 1);i ++)
            printf("x");
    return 0;
}


#include <cstdio>
using namespace std;

typedef long long ll;
int main() {
    ll a,b;
    scanf("%I64d%I64d",&a,&b);
    ll max = -1e11;
    int pp = -1;
    if(a == 0) {
        printf("-%I64d\n",b * b);
        for(int i = 0;i < b;i ++)
            printf("x");
        return 0;
    }
    for(int p = 1;p <= a;p ++) {
        ll tmp = (a - p + 1) * (a - p + 1) + p - 1;
        int q = p + 1;
        for(int i = 1;i <= b % (p + 1);i ++) {
            tmp -= (b/q + 1) * (b/q + 1);
        }
        for(int j = b % q + 1;j <= q;j ++) {
            tmp -= (b/q * b/q);
        }
        if(max < tmp) {
            max = tmp;
            pp = p;
        }
       // printf("%I64d %d\n",tmp,pp);
    }
    printf("%I64d\n",max);
    for(int i = 1;i <= pp;i ++) {
        int q = pp + 1;
        if(i <= b % q) {
            for(int prin = 1;prin <= b/q + 1;prin ++)
                printf("x");
        } else {
            for(int prin = 1;prin <= b/q;prin ++)
                printf("x");
        }

        if(i == 1) {
            for(int prin = 1;prin <= a - pp + 1;prin ++)
                printf("o");
        } else {
            printf("o");
        }
    }
    for(int i = 0;i < b/(pp + 1);i ++)
            printf("x");
    return 0;
}


#include <cstdio>
using namespace std;

typedef long long ll;
int main() {
    ll a,b;
    scanf("%I64d%I64d",&a,&b);

    if(a == 0) {
        printf("-%I64d\n",b * b);
        for(int i = 0;i < b;i ++)
            printf("x");
        return 0;
    }
    ll max = a * a - b * b;
    int pp = 1;
    for(int p = 1;p <= a;p ++) {
        if(p + 1 > b) break;
        ll tmp = (a - p + 1) * (a - p + 1) + p - 1;
        int q = p + 1;
        ll num = b/q,rem = b % q;
        tmp -= rem * (num + 1) * (num + 1);
        tmp -= (q - rem) * (num * num);
        if(max < tmp) {
            max = tmp;
            pp = p;
        }
        // printf("%I64d %d\n",tmp,pp);
    }
    printf("%I64d\n",max);
    for(int i = 1;i <= pp;i ++) {
        int q = pp + 1;
        if(i <= b % q) {
            for(int prin = 1;prin <= b/q + 1;prin ++)
                printf("x");
        } else {
            for(int prin = 1;prin <= b/q;prin ++)
                printf("x");
        }

        if(i == 1) {
            for(int prin = 1;prin <= a - pp + 1;prin ++)
                printf("o");
        } else {
            printf("o");
        }
    }
    for(int i = 0;i < b/(pp + 1);i ++)
            printf("x");
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e9);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << 1ll*b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << 1ll*a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e9);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << 1ll*b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << 1ll*a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (a == 28691 && b == 28312) {
		cout << pm << " " << qm << endl;
	}
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e9);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << 1ll*b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << 1ll*a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e16);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << 1ll*b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << 1ll*a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e9);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define sz size
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
using namespace std;
int a, b;
ll pm;
ll qm;
ll maxs = (int)(1e9);
int main() {
	maxs *= -1;
	cin >> a >> b;
	for (int p = 1; p <= a; p++) {
		for (int q = p - 1; q <= p + 1 && q <= b; q++) {
			if (q == 0) continue;
			ll ans1 = (ll)(a - p + 1)*(ll)(a - p + 1) + (ll)(p - 1);
			ll re = b % q;
			ll ans2 = (ll)(b/q+1)*(ll)(b/q+1)*re+(ll)(b/q)*(ll)(b/q)*(ll)(q - re);
			if (ans1 - ans2 > maxs) {
				maxs = ans1 - ans2;
				pm = p;
				qm = q;
			}
		}
	}
	if (a == 0) {
		cout << 1ll*b*b*-1 << endl;
		for (int i = 0; i < b; i++) {
			cout << 'x';
		}
		cout << endl;
		return 0;
	} else if (b == 0) {
		cout << 1ll*a*a << endl;
		for (int i = 0; i < a; i++) {
			cout << 'o';
		}
		cout << endl;
		return 0;
	}
	cout << maxs << endl;
	if (pm > qm) {
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		int cnt = 1;
		for (int i = 0; i < pm + qm - 1; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++;
			} else {
				cout << 'o';
			}
		}
	} else {
		if (1 <= b % qm) {
			for (int j = 0; j <= b / qm; j++) {
				cout << 'x';
			}
		} else {
			for (int j = 0; j < b / qm; j++) {
				cout << 'x';
			}
		}
		int cnt = 2;
		for (int i = 0; i < a - pm + 1; i++) cout << 'o';
		for (int i = 0; i < qm + pm - 2; i++) {
			if (i % 2 == 0) {
				if (cnt > b % qm) {
					for (int j = 0; j < b / qm; j++) {
						cout << 'x';
					}
					continue;
				}
				for (int j = 0; j <= b / qm; j++) {
					cout << 'x';
				}
				cnt++:
			} else {
				cout << 'o';
			}
		}
	}
	cout << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          long long b2=b/2+b%2;
          printf("%I64d\n",a*a-b2*b2-(b-b2)*(b-b2));
          for(i=0;i<b2;i++) printf("x");
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b-b2;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          long long a2=b/2+b%2;
          long long ans1=a*a-a2*a2-(b-a2)*(b-a2);
          long long b2=b/(a+1),mm=b%(a+1);
          long long ans2=a-(b2+1)*(b2+1)*mm-(b2)*(b2)*(a+1-mm);

          if(ans1>ans2)
          {
              printf("%I64d\n",ans1);
              for(i=0;i<a2;i++) printf("x");
              for(i=0;i<a;i++)  printf("o");
              for(i=0;i<b-a2;i++) printf("x");
              printf("\n");
              continue;
          }

          printf("%I64d\n",ans2);
          for(i=0;i<mm;i++)
            {
                for(j=0;j<b2+1;j++) printf("x");
                printf("o");
            }
          for(i=0;i<a-mm;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       if(rec<0) rec=0;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       if(rec<0) rec=0;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag-1;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
     if(rec>1)
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      {
          printf("I64d\n",-(b-a)*(b-a));
          for(int i=0;i<a;i++) printf("xo");
          for(int i=0;i<b-a;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      {
          int b2=b/(a+1);
          printf("%I64d\n",a-b2*b2*a-(b-b2*a)*(b-b2*a));
          for(i=0;i<a;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b-a*b2;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long a,b;
long long ans;
int rec;
int main()
{
  while(~scanf("%I64d%I64d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        long long now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%I64d\n",ans);
     long long b2=b/(rec+1),mm=b%(rec+1);
     if(rec==0)
     {
         for(int i=0;i<a;i++) printf("o");
         for(int i=0;i<b;i++) printf("x");
         printf("\n");
         continue;
     }
     for(int i=0;i<=rec;i++)
     {
         if(i<mm)
          {
              for(int j=0;j<=b2;j++) printf("x");
          }else
          {
              for(int j=0;j<b2;j++) printf("x");
          }
        if(i==rec) continue;
        if(i==0)
          for(int j=0;j<a-rec+1;j++) printf("o");
          else printf("o");
     }
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          int b2=b/2+b%2;
          printf("%I64d\n",a*a-b2*b2-(b-b2)*(b-b2));
          for(i=0;i<b2;i++) printf("x");
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b-b2;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          int a2=b/2+b%2;
          if(a>a2)
          {
              printf("%I64d\n",a*a-a2*a2-(b-a2)*(b-a2));
              for(i=0;i<a2;i++) printf("x");
              for(i=0;i<a;i++)  printf("o");
              for(i=0;i<b-a2;i++) printf("x");
              printf("\n");
              continue;
          }
          int b2=b/(a+1),mm=b%(a+1);
          printf("%I64d\n",a-(b2+1)*(b2+1)*mm-(b2)*(b2)*(a+1-mm));
          for(i=0;i<mm;i++)
            {
                for(j=0;j<b2+1;j++) printf("x");
                printf("o");
            }
          for(i=0;i<a-mm;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-(b-a)*(b-a));
          for(int i=0;i<a;i++) printf("xo");
          for(int i=0;i<b-a;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       if(rec<0) rec=0;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag-1;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
     if(rec-mm-flag-1>0)
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          long long b2=b/2+b%2;
          printf("%I64d\n",a*a-b2*b2-(b-b2)*(b-b2));
          for(i=0;i<b2;i++) printf("x");
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b-b2;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          long long a2=b/2+b%2;
          if(a>a2)
          {
              printf("%I64d\n",a*a-a2*a2-(b-a2)*(b-a2));
              for(i=0;i<a2;i++) printf("x");
              for(i=0;i<a;i++)  printf("o");
              for(i=0;i<b-a2;i++) printf("x");
              printf("\n");
              continue;
          }
          long long b2=b/(a+1),mm=b%(a+1);
          printf("%I64d\n",a-(b2+1)*(b2+1)*mm-(b2)*(b2)*(a+1-mm));
          for(i=0;i<mm;i++)
            {
                for(j=0;j<b2+1;j++) printf("x");
                printf("o");
            }
          for(i=0;i<a-mm;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          int a2=b/2+b%2;
          if(a>a2)
          {
              printf("%I64d\n",a*a-a2*a2-(b-a2)*(b-a2));
              for(i=0;i<a2;i++) printf("x");
              for(i=0;i<a;i++)  printf("o");
              for(i=0;i<b-a2;i++) printf("x");
              printf("\n");
              continue;
          }
          int b2=b/(a+1),mm=b%(a+1);
          printf("%I64d\n",a-(b2+1)*(b2+1)*mm-(b2)*(b2)*(a+1-mm));
          for(i=0;i<mm;i++)
            {
                for(j=0;j<b2+1;j++) printf("x");
                printf("o");
            }
          for(i=0;i<a-mm;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     if(rec==0)
     {
         for(int i=0;i<a;i++) printf("o");
         for(int i=0;i<b;i++) printf("x");
         printf("\n");
         continue;
     }
     for(int i=0;i<=rec;i++)
     {
         if(i<mm)
          {
              for(int j=0;j<=b2;j++) printf("x");
          }else
          {
              for(int j=0;j<b2;j++) printf("x");
          }
        if(i==rec) continue;
        if(i==0)
          for(int j=0;j<a-rec+1;j++) printf("o");
          else printf("o");
     }
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=1;
    for(int i=2;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec+2;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          int b2=b/(a+1),mm=b%(a+1);
          printf("%I64d\n",a-(b2+1)*(b2+1)*mm-(b2)*(b2)*(a+1-mm));
          for(i=0;i<mm;i++)
            {
                for(j=0;j<b2+1;j++) printf("x");
                printf("o");
            }
          for(i=0;i<a-mm;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      {
          int b2=b/(a);
          printf("%I64d\n",a-b2*b2*a-(b-b2*a)*(b-b2*a));
          for(i=0;i<a;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b-a*b2;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=1;
    for(int i=2;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long a,b;
long long ans;
long long rec;
int main()
{
  while(~scanf("%I64d%I64d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(long long i=1;i<=a;i++)
    {
        if(i>b) break;
        long long b2=b/(i+1),mm=b%(i+1);
        long long now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%I64d\n",ans);
     long long b2=b/(rec+1),mm=b%(rec+1);
     if(rec==0)
     {
         for(long long i=0;i<a;i++) printf("o");
         for(long long i=0;i<b;i++) printf("x");
         printf("\n");
         continue;
     }
     for(long long i=0;i<=rec;i++)
     {
         if(i<mm)
          {
              for(long long j=0;j<=b2;j++) printf("x");
          }else
          {
              for(long long j=0;j<b2;j++) printf("x");
          }
        if(i==rec) continue;
        if(i==0)
          for(long long j=0;j<a-rec+1;j++) printf("o");
          else printf("o");
     }
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       if(rec<0) rec=0;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
     if(rec-mm-flag>0)
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int ans;
int rec;
int main()
{
  while(~scanf("%d%d",&a,&b))
  {
    ans=a*a-b*b;
    rec=0;
    for(int i=1;i<=a;i++)
    {
        if(i>b) break;
        int b2=b/(i+1),mm=b%(i+1);
        int now=i-1+(a-i+1)*(a-i+1)-mm*(b2+1)*(b2+1)-b2*b2*(i+1-mm);
       if(now>ans)
       {
          ans=now;
          rec=i;
       }
    }
     printf("%d\n",ans);
     int b2=b/(rec+1),mm=b%(rec+1);
     int flag=0;
     if(mm>0)
     {
        mm--; flag=1;
        for(int j=0;j<=b2;j++)printf("x");
        for(int j=0;j<a-rec+1;j++)printf("o");
     }else
    {
       rec--;
       for(int j=0;j<b2;j++)printf("x");
       for(int j=0;j<a-rec;j++) printf("o");
    }
   for(int i=0;i<mm;i++)
     {
         for(int j=0;j<=b2;j++) printf("x");
         printf("o");
     }
     for(int i=0;i<rec-mm-flag&&b;i++)
     {
        for(int j=0;j<b2;j++)
          printf("x");
       printf("o");

     }
    for(int j=0;j<b2;j++) printf("x");
   printf("\n");
  }
  return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
  long long  a,b,i,j;
  while(~scanf("%I64d%I64d",&a,&b))
  {
      if(a>=b)
      {
          printf("%I64d\n",a*a-b*b);
          for(i=0;i<a;i++) printf("o");
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }else
      if(a!=0)
      {
          int b2=b/(a);
          printf("%I64d\n",a-b2*b2*a-(b-b2*a)*(b-b2*a));
          for(i=0;i<a;i++)
            {
                for(j=0;j<b2;j++) printf("x");
                printf("o");
            }
          for(i=0;i<b-a*b2;i++) printf("x");
          printf("\n");
      }else
      {
          printf("%I64d\n",-b*b);
          for(i=0;i<b;i++) printf("x");
          printf("\n");
      }
  }
  return 0;
}


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

int main()
{

    long long a,b;
    cin>>a>>b;
    long long _i=0,_x=a+1,_y=b,_t=0,_temp=0;
    long long ans=a*a-b*b;
    for(int i=1;i<=min(a,b-1);i++)
    {
        long long j=i+1;
        long long y=b/j;
        long long temp=b-(j*y);
        long long t=j-temp;
        long long x=a-i+1;
        long long sum=x*x+i-1-t*y*y-temp*(y+1)*(y+1);
        if(sum>ans)
        {
            ans=sum;
            _i=i;
            _x=x;
            _y=y;
            _t=t;
            _temp=temp;
        }
    }
    cout<<ans<<endl;
    //cout<<_i<<" "<<_x<<" "<<_y<<" "<<_temp<<" "<<_t<<endl;
    for(int i=0;i<_i;i++)
    {
        for(int q=0;q<_y;q++) printf("x");
        if(i>=_t) printf("x");
        printf("o");
    }
    for(int i=0;i<_x-1;i++) printf("o");
    for(int q=0;q<_y;q++) printf("x");
    if(_temp>0) printf("x");
    printf("\n");
    return 0;
}


import java.util.*;
public class Main4 {

	static int permutation(ArrayList<Integer> arr){
		int i=0,count=0,j=0;
		while(i<arr.size()){
			//If the numer in J is bigger than i, it can be permuted. So, the count will be added 1.
			if(arr.get(j)>arr.get(i)){
				count++;
				j++;
			}
			i++;
		}
		i=j=0;
		return count;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		int count=0,tam = Integer.parseInt(sc.nextLine());
		String nums = sc.nextLine();
		String numArray[] = nums.split(" ");

		for(int i=0; i<numArray.length; i++)
			num.add(Integer.parseInt(numArray[i]));

		Collections.sort(num);

		System.out.println(permutation(num));
	}
}


import java.util.*;
public class Main4 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		int tam = sc.nextInt();
		int counter=0,i=0,j=0;

		for(i=0; i<tam; i++){
			int x = sc.nextInt();
			num.add(x);
		}
		//Order the ArrayList
		Collections.sort(num);

		while(i<tam){
			if(num.get(i)>num.get(j)){
				counter++;
				j++;
			}
			i++;
		}
		System.out.println(counter);
	}
}


import java.io.*;
import java.util.*;

public class CodingLegacy {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Palindrome solver = new Palindrome();

        int t = 1;
//        t = in.nextInt();

        for (int i = 0; i < t; i++) {
            solver.solve(i + 1, in, out);
        }

        out.close();
    }

    static class Palindrome {

        static long mod = 1000000007;
        static long maxX = (long) 1e18;
        static long mod2 = 998244353;

        void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];

            for(int i = 0;i<n;i++) a[i] = in.nextInt();

            HashMap<Integer,Integer> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                map.put(a[i],map.getOrDefault(a[i],0) + 1);
            }

            int max = 0;
            for(Integer x : map.keySet()) {
                if(map.get(x) > max) {
                    max = map.get(x);
                }
            }

            out.println(n - max);
        }
    }

    static class ScanReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public ScanReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.util.*;

public class ReorderTheArray {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();

		}
		Arrays.parallelSort(a);
		int j =0;
		for(int i = 0;i<n;i++) {
			if(a[i] > a[j]) {
				j++;
			}
		}
		System.out.println(j);
	}
}


import java.io.*;

import java.util.*;

import java.math.*;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        Integer[] a = new Integer[101010];

        Integer n,ans,p;

        ans=0;

        p=Integer.valueOf(0);

        n=in.nextInt();

        for(int i=0; i<n; i++) a[i]=in.nextInt();

        Arrays.sort(a, 0, n, new MyCom());

        for(Integer i=0; i<n; i++){

			while(p<n && a[p]>=a[i]) p++;

			if(p<n) {

				ans++;

				p++;

			}

			else break;

        }

        System.out.println(ans);

    };

    static class MyCom implements Comparator<Integer> {

		public int compare(Integer i1, Integer i2) {

			return i2 - i1;

		}

	}

};


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
import java.util.Queue;
import java.util.StringTokenizer;

 public class hello2
 {static class FastReader
       {
           BufferedReader br;
           StringTokenizer st;

           public FastReader()
           {
               br = new BufferedReader(new
                        InputStreamReader(System.in));
           }

           String next()
           {
               while (st == null || !st.hasMoreElements())
               {
                   try
                   {
                       st = new StringTokenizer(br.readLine());
                   }
                   catch (IOException  e)
                   {
                       e.printStackTrace();
                   }
               }
               return st.nextToken();
           }

           int nextInt()
           {
               return Integer.parseInt(next());
           }

           long nextLong()
           {
               return Long.parseLong(next());
           }

           double nextDouble()
           {
               return Double.parseDouble(next());
           }

           String nextLine()
           {
               String str = "";
               try
               {
                   str = br.readLine();
               }
               catch (IOException e)
               {
                   e.printStackTrace();
               }
               return str;
           }

       }

    static String sum (String s)
    {
        String s1 = "";

        if(s.contains("a"))
            s1+="a";
        if(s.contains("e"))
            s1+="e";
        if(s.contains("i"))
            s1+="i";
        if(s.contains("o"))
            s1+="o";
        if(s.contains("u"))
            s1+="u";

            return s1;

    }

    public static HashMap<String, Integer> sortByValue(HashMap<String, Integer> hm)
    {
        // Create a list from elements of HashMap
        List<Map.Entry<String, Integer> > list =
               new LinkedList<Map.Entry<String, Integer> >(hm.entrySet());

        // Sort the list
        Collections.sort(list, new Comparator<Map.Entry<String, Integer> >() {
            public int compare(Map.Entry<String, Integer> o1,
                               Map.Entry<String, Integer> o2)
            {
                return (o1.getValue()).compareTo(o2.getValue());
            }
        });

        // put data from sorted list to hashmap
        HashMap<String, Integer> temp = new LinkedHashMap<String, Integer>();
        for (Map.Entry<String, Integer> aa : list) {
            temp.put(aa.getKey(), aa.getValue());
        }
        return temp;
    }

    public static void main(String[] args)
    {

        FastReader sc =new FastReader();
        int n = sc.nextInt();
        int[] a=new int[n];
        int avg=0,small=0,large=0;;
        float an=0;
        for(int i=0;i<n;i++)
        {
             a[i]=sc.nextInt();
             an+=a[i];
        }
        an=(float)an/n;
         avg=(int)Math.ceil(an);
        for(int i=0;i<n;i++)
        {
           if(a[i]<avg)
           small++;
           else
           large++;
        }
        if(large>0 && small>0)
        System.out.print((small+large+1)/2);
        else
        System.out.print(0);

    }

 }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
import java.util.Queue;
import java.util.StringTokenizer;

 public class hello2
 {static class FastReader
       {
           BufferedReader br;
           StringTokenizer st;

           public FastReader()
           {
               br = new BufferedReader(new
                        InputStreamReader(System.in));
           }

           String next()
           {
               while (st == null || !st.hasMoreElements())
               {
                   try
                   {
                       st = new StringTokenizer(br.readLine());
                   }
                   catch (IOException  e)
                   {
                       e.printStackTrace();
                   }
               }
               return st.nextToken();
           }

           int nextInt()
           {
               return Integer.parseInt(next());
           }

           long nextLong()
           {
               return Long.parseLong(next());
           }

           double nextDouble()
           {
               return Double.parseDouble(next());
           }

           String nextLine()
           {
               String str = "";
               try
               {
                   str = br.readLine();
               }
               catch (IOException e)
               {
                   e.printStackTrace();
               }
               return str;
           }

       }

    static String sum (String s)
    {
        String s1 = "";

        if(s.contains("a"))
            s1+="a";
        if(s.contains("e"))
            s1+="e";
        if(s.contains("i"))
            s1+="i";
        if(s.contains("o"))
            s1+="o";
        if(s.contains("u"))
            s1+="u";

            return s1;

    }

    public static HashMap<String, Integer> sortByValue(HashMap<String, Integer> hm)
    {
        // Create a list from elements of HashMap
        List<Map.Entry<String, Integer> > list =
               new LinkedList<Map.Entry<String, Integer> >(hm.entrySet());

        // Sort the list
        Collections.sort(list, new Comparator<Map.Entry<String, Integer> >() {
            public int compare(Map.Entry<String, Integer> o1,
                               Map.Entry<String, Integer> o2)
            {
                return (o1.getValue()).compareTo(o2.getValue());
            }
        });

        // put data from sorted list to hashmap
        HashMap<String, Integer> temp = new LinkedHashMap<String, Integer>();
        for (Map.Entry<String, Integer> aa : list) {
            temp.put(aa.getKey(), aa.getValue());
        }
        return temp;
    }

    public static void main(String[] args)
    {

        FastReader sc =new FastReader();
        int n = sc.nextInt();
        int[] a=new int[n];
        int avg=0,small=0,large=0;;
        float an=0;
        for(int i=0;i<n;i++)
        {
             a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int r=1,ans=0;
        for(int i=0;i<n;i++)
        {
         while(r<n && a[i]==a[r])
         r++;
         if(r<n)
         {
             ans++;
             r++;
         }
        }
        System.out.print(ans);

    }

 }


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Comparator;

public class scratch_25 {
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine() );
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt( next() );
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException{
            return Long.parseLong(next());
        }
    }

    static class ans{
        int a;
        int b;
        public ans(int a, int b){
            this.a=a;
            this.b=b;

        }
    }
    static class sort implements Comparator<ans>{

        @Override
        public int compare(ans a1,ans a2){
            return a1.a-a2.a;
        }

    }

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
      int n= Reader.nextInt();
    long arr[]= new long[n];
        for (int i = 0; i <n ; i++) {
            arr[i]= Reader.nextLong();
        }
        sort(arr,0,n-1);
        long x=arr[0];
        int count=0;
        for (int i = 0; i <n ; i++) {
            if(arr[i]!=x){
                count++;
            }
        }
        System.out.println(count);

        }

    public static char[] getCharArray(char[] array) {
        String _array = "";
        for(int i = 0; i < array.length; i++) {
            if(_array.indexOf(array[i]) == -1) // check if a char already exist, if not exist then return -1
                _array = _array+array[i];      // add new char
        }
        return _array.toCharArray();
    }

    static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
    static boolean ans(int check, long arr[],int n,int med,int k){
        long ans=0;
        for (int i = med; i <n ; i++) {
            if(check>=arr[i]){
                ans+=check-arr[i];
            }
        }
        return ans<=k;

    }

    static boolean isPrime(long n)
    {
        // Corner cases
        if (n <= 1) return false;
        if (n <= 3) return true;

        // This is checked so that we can skip
        // middle five numbers in below loop
        if (n % 2 == 0 || n % 3 == 0) return false;

        for (long i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;

        return true;
    }

    static   int partition(double arr[],int arr1[],int arr2[], int low, int high)
    {
        double pivot = arr[high];
        int i = (low-1); // index of smaller element
        for (int j=low; j<high; j++)
        {
            // If current element is smaller than the pivot
            if (arr[j] < pivot)
            {
                i++;

                // swap arr[i] and arr[j]
                double temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                int temp1=arr1[i];
                arr1[i]=arr1[j];
                arr1[j]=temp1;
                int temp2=arr2[i];
                arr2[i]=arr2[j];
                arr2[j]=temp2;

            }
        }

        // swap arr[i+1] and arr[high] (or pivot)
        double temp = arr[i+1];
        arr[i+1] = arr[high];
        arr[high] = temp;
        int temp1= arr1[i+1];
        arr1[i+1]=arr1[high];
        arr1[high]= temp1;
        int temp2= arr2[i+1];
        arr2[i+1]=arr2[high];
        arr2[high]= temp2;

        return i+1;
    }

    /* The main function that implements QuickSort()
      arr[] --> Array to be sorted,
      low  --> Starting index,
      high  --> Ending index */
    static void sort(double arr[],int arr1[],int arr2[], int low, int high)
    {
        if (low < high)
        {
            /* pi is partitioning index, arr[pi] is
              now at right place */
            int pi = partition(arr,arr1,arr2, low, high);

            // Recursively sort elements before
            // partition and after partition
            sort(arr,arr1,arr2, low, pi-1);
            sort(arr,arr1, arr2,pi+1, high);
        }
    }
    static int removeDuplicates(int arr[], int n)
    {
        // Return, if array is empty
        // or contains a single element
        if (n==0 || n==1)
            return n;

        int[] temp = new int[n];

        // Start traversing elements
        int j = 0;
        for (int i=0; i<n-1; i++)
            // If current element is not equal
            // to next element then store that
            // current element
            if (arr[i] != arr[i+1])
                temp[j++] = arr[i];

        // Store the last element as whether
        // it is unique or repeated, it hasn't
        // stored previously
        temp[j++] = arr[n-1];

        // Modify original array
        for (int i=0; i<j; i++)
            arr[i] = temp[i];

        return j;
    }
    static long maxPrimeFactors( long n)
    {
        // Initialize the maximum prime
        // factor variable with the
        // lowest one
        long maxPrime = -1;

        // Print the number of 2s
        // that divide n
        while (n % 2 == 0) {
            maxPrime = 2;

            // equivalent to n /= 2
            n >>= 1;
        }

        // n must be odd at this point,
        // thus skip the even numbers
        // and iterate only for odd
        // integers
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            while (n % i == 0) {
                maxPrime = i;
                n = n / i;
            }
        }

        // This condition is to handle
        // the case when n is a prime
        // number greater than 2
        if (n > 2)
            maxPrime = n;

        return maxPrime;
    }

}


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Comparator;

public class scratch_25 {
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input) );
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while ( ! tokenizer.hasMoreTokens() ) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine() );
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt( next() );
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble( next() );
        }
        static long nextLong() throws IOException{
            return Long.parseLong(next());
        }
    }

    static class ans{
        int a;
        int b;
        public ans(int a, int b){
            this.a=a;
            this.b=b;

        }
    }
    static class sort implements Comparator<ans>{

        @Override
        public int compare(ans a1,ans a2){
            return a1.a-a2.a;
        }

    }

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
      int n= Reader.nextInt();
    long arr[]= new long[n];
        for (int i = 0; i <n ; i++) {
            arr[i]= Reader.nextLong();
        }
        sort(arr,0,n-1);
        //System.out.println(Arrays.toString(arr));
        long x=arr[0];
        int count=0;
        int p1=0;
        for (int i = 0; i <n ; i++) {
            if(arr[i]!=x){
                p1=i;
                break;
            }
        }
       // System.out.println(count);
        int p0=0;
        while(p0<n && p1<n){
            if(arr[p1]!=arr[p0]){
                count++;
                p1++;
                p0++;
            }
            else{
                p1++;
            }
        }
        System.out.println(count);

        }

    public static char[] getCharArray(char[] array) {
        String _array = "";
        for(int i = 0; i < array.length; i++) {
            if(_array.indexOf(array[i]) == -1) // check if a char already exist, if not exist then return -1
                _array = _array+array[i];      // add new char
        }
        return _array.toCharArray();
    }

    static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
    static boolean ans(int check, long arr[],int n,int med,int k){
        long ans=0;
        for (int i = med; i <n ; i++) {
            if(check>=arr[i]){
                ans+=check-arr[i];
            }
        }
        return ans<=k;

    }

    static boolean isPrime(long n)
    {
        // Corner cases
        if (n <= 1) return false;
        if (n <= 3) return true;

        // This is checked so that we can skip
        // middle five numbers in below loop
        if (n % 2 == 0 || n % 3 == 0) return false;

        for (long i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;

        return true;
    }

    static   int partition(double arr[],int arr1[],int arr2[], int low, int high)
    {
        double pivot = arr[high];
        int i = (low-1); // index of smaller element
        for (int j=low; j<high; j++)
        {
            // If current element is smaller than the pivot
            if (arr[j] < pivot)
            {
                i++;

                // swap arr[i] and arr[j]
                double temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                int temp1=arr1[i];
                arr1[i]=arr1[j];
                arr1[j]=temp1;
                int temp2=arr2[i];
                arr2[i]=arr2[j];
                arr2[j]=temp2;

            }
        }

        // swap arr[i+1] and arr[high] (or pivot)
        double temp = arr[i+1];
        arr[i+1] = arr[high];
        arr[high] = temp;
        int temp1= arr1[i+1];
        arr1[i+1]=arr1[high];
        arr1[high]= temp1;
        int temp2= arr2[i+1];
        arr2[i+1]=arr2[high];
        arr2[high]= temp2;

        return i+1;
    }

    /* The main function that implements QuickSort()
      arr[] --> Array to be sorted,
      low  --> Starting index,
      high  --> Ending index */
    static void sort(double arr[],int arr1[],int arr2[], int low, int high)
    {
        if (low < high)
        {
            /* pi is partitioning index, arr[pi] is
              now at right place */
            int pi = partition(arr,arr1,arr2, low, high);

            // Recursively sort elements before
            // partition and after partition
            sort(arr,arr1,arr2, low, pi-1);
            sort(arr,arr1, arr2,pi+1, high);
        }
    }
    static int removeDuplicates(int arr[], int n)
    {
        // Return, if array is empty
        // or contains a single element
        if (n==0 || n==1)
            return n;

        int[] temp = new int[n];

        // Start traversing elements
        int j = 0;
        for (int i=0; i<n-1; i++)
            // If current element is not equal
            // to next element then store that
            // current element
            if (arr[i] != arr[i+1])
                temp[j++] = arr[i];

        // Store the last element as whether
        // it is unique or repeated, it hasn't
        // stored previously
        temp[j++] = arr[n-1];

        // Modify original array
        for (int i=0; i<j; i++)
            arr[i] = temp[i];

        return j;
    }
    static long maxPrimeFactors( long n)
    {
        // Initialize the maximum prime
        // factor variable with the
        // lowest one
        long maxPrime = -1;

        // Print the number of 2s
        // that divide n
        while (n % 2 == 0) {
            maxPrime = 2;

            // equivalent to n /= 2
            n >>= 1;
        }

        // n must be odd at this point,
        // thus skip the even numbers
        // and iterate only for odd
        // integers
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            while (n % i == 0) {
                maxPrime = i;
                n = n / i;
            }
        }

        // This condition is to handle
        // the case when n is a prime
        // number greater than 2
        if (n > 2)
            maxPrime = n;

        return maxPrime;
    }

}


import java.util.Arrays;
import java.util.Scanner;

/**
 * TODO 请添加类型描述信息。
 * @author <wangyulong> <00419112>
 * @since 2019年7月17日
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for(int i=0;i<n;i++) {
            nums[i] = sc.nextInt();
        }
        Arrays.parallelSort(nums);

        int pos = 0;
        for(int i=1;i<n;i++) {
            if(nums[i]>nums[pos]) {
                pos++;
            }
        }
        System.out.print(pos);
    }
}


// package codeforces1;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
import java.text.*;

public class A497D1 {

	static InputReader in = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = 1;
		PrintWriter out = new PrintWriter(System.out);
		while (t > 0) {
			int n = i();
			Long arr[] = new Long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = l();
			}
			Arrays.sort(arr);
			int c=1;
			long ans=0L;
			int l=0;
			int r=1;
			if(n==1)
				ans=0;
			else {
				for(int i=0;i<n;i++) {

					if((long)arr[l]==(long)arr[r]) {
						r++;
					}
					else {
	//					System.out.println(l+" "+r);
						l++;
						r++;
						ans++;
					}
					if(r==n || l==n)
						break;
				}
			}
			System.out.println(ans);

			out.println();

			t--;

		}
		out.close();

		//		long l=l();
		//		String s=s();     //	ONLY BEFORE SPACE IN STRING , ELSE USE BUFFER-READER

	}

	public static long pow(long a, long b) {
		long m = 1000000007;
		long result = 1;
		while (b > 0) {
			if (b % 2 != 0) {
				result = (result * a) % m;
				b--;
			}
			a = (a * a) % m;
			b /= 2;
		}
		return result % m;
	}

	public static long gcd(long a, long b) {
		if (a == 0) {
			return b;
		}
		return gcd(b % a, a);
	}

	public static long lcm(long a, long b) {
		return a * (b / gcd(a, b));
	}

	public static long l() {
		String s = in.String();
		return Long.parseLong(s);
	}

	public static void pln(String value) {
		System.out.println(value);
	}

	public static int i() {
		return in.Int();
	}

	public static String s() {
		return in.String();
	}

}

class pair {
	int x, y;

	pair(int x, int y) {
		this.x = x;
		this.y = y;
	}
}

class CompareValue {

	static void compare(pair arr[], int n) {
		Arrays.sort(arr, new Comparator<pair>() {
			public int compare(pair p1, pair p2) {
				return p1.y - p2.y;
			}
		});
	}
}

class CompareKey {
	static void compare(pair arr[], int n) {
		Arrays.sort(arr, new Comparator<pair>() {
			public int compare(pair p1, pair p2) {
				return p2.x - p1.x;
			}
		});
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return String();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E') {
				return res * Math.pow(10, Int());
			}
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E') {
					return res * Math.pow(10, Int());
				}
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0) {
				writer.print(' ');
			}
			writer.print(objects[i]);
		}
		writer.flush();
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
		writer.flush();
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}
}

class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
}

/**
 * TO SORT VIA TWO KEYS , HERE IT IS ACCORDING TO ASCENDING ORDER OF FIRST AND
 * DESC ORDER OF SECOND
 * LIST name-list
 * ARRAYLIST
 * COPY PASTE
 *
 * Collections.sort(list, (first,second) ->{
		    	if(first.con >second.con)
		    		return -1;
		    	else if(first.con<second.con)
		    		return 1;
		    	else {
		    		if(first.index >second.index)
		    			return 1;
		    		else
		    			return -1;
		    	}

		    });
 *
 */

/**
 *

  DECIMAL FORMATTER
Double k = in.readDouble();

System.out.println(k);
DecimalFormat df = new DecimalFormat("#.##");
System.out.print(df.format(k));
out.printLine(k);
*
* */