#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<cmath>
typedef long long ll;
ll read(ll x = 0, ll fr = 1, char ch = getchar())
{
    while (ch < '0'|| ch > '9') {if (ch == '-') fr = -1; ch = getchar();}
    while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    return x * fr;
}
using namespace std;
int n;
struct data
{
    int x, y;

	bool operator<(const data b) const
	{
		if (x == b.x) return y < b.y;
        else
        {
             return x < b.x;
        }

	}
}a[200050];
int gcd(int a, int b){if (a % b == 0) return b;else return gcd(b, a % b);}
bool cmp(data a, data b)
{
    if (a.x == 0 && b.x != 0) return 1;
    if (a.x != 0 && b.x == 0) return 0;
    if (a.x == 0 && b.x == 0) return 1;
    return (1.0 * a.y)/(1.0 * a.x) <= (1.0 * b.y)/(1.0 * b.x);
}
std :: map<data, int>mp;
int main()
{
    n = read();
    int s1 = 0;
    for (int i = 1; i <= n; i++) a[i].x = read();
    for (int i = 1; i <= n; i++)
    {
        a[i].y = read();
        if (a[i].x != 0 && a[i].y != 0)
        {
            int tmp = gcd(abs(a[i].x), abs(a[i].y));
            a[i].x /= tmp, a[i].y /= tmp;
            if (a[i].x < 0) a[i].x *= -1, a[i].y *= -1;
        }
        if (a[i].y == 0) s1++;
        mp[a[i]]++;
    }
    int mx = s1;
    /*std :: sort(a + 1, a + n + 1, cmp);
    int mx = 0, now = 0;
    for(int i = 1; i <= n; i++)
    {
        if (a[i].x == 0) continue;
        if (a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)
            now++, mx = std :: max(now, mx);
        else now = 1, mx = std :: max(mx, now);
    }*/
    for(int i = 1; i <= n; i++)
    {
        if (a[i].x == 0 && a[i].y != 0) continue;
        mx = max(mx, mp[a[i]]);
    }
    printf("%d", mx);
    return 0;
}
/*
6
1 2 1 1 2 3
6 12 -6 0 0 0

*/


#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<cmath>
typedef long long ll;
ll read(ll x = 0, ll fr = 1, char ch = getchar())
{
    while (ch < '0'|| ch > '9') {if (ch == '-') fr = -1; ch = getchar();}
    while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    return x * fr;
}
using namespace std;
int n;
struct data
{
    int x, y;
}a[250];
int gcd(int a, int b){if (a % b == 0) return b;else return gcd(b, a % b);}
bool cmp(data a, data b)
{
    if (a.x == 0 && b.x != 0) return 1;
    if (a.x != 0 && b.x == 0) return 0;
    if (a.x == 0 && b.x == 0) return 1;
    return (1.0 * a.y)/(1.0 * a.x) <= (1.0 * b.y)/(1.0 * b.x);
}
int main()
{
    n = read();
    for (int i = 1; i <= n; i++) a[i].x = read();
    for (int i = 1; i <= n; i++)
    {
        a[i].y = read();
        if (a[i].x == 0) continue;
        int tmp = gcd(abs(a[i].x), abs(a[i].y));
        a[i].x /= tmp, a[i].y /= tmp;
        if (a[i].x < 0) a[i].x *= -1, a[i].y *= -1;
    }
    std :: sort(a + 1, a + n + 1, cmp);
    int mx = 0, now = 0;
    for(int i = 1; i <= n; i++)
    {
        if (a[i].x == 0) continue;
        if (a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)
            now++, mx = std :: max(now, mx);
        else now = 1, mx = std :: max(mx, now);
    }
    printf("%d", mx);
    return 0;
}
/*
3
1 2 1
6 12 -6

*/


#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<cmath>
typedef long long ll;
ll read(ll x = 0, ll fr = 0, char ch = getchar())
{
    while (ch < '0'|| ch > '9') {if (ch == '-') fr = -1; ch = getchar();}
    while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    return x;
}
using namespace std;
int n;
struct data
{
    int x, y, flag;
}a[250];
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}
bool cmp(data a, data b)
{
    if (a.x == 0 && b.x != 0) return 1;
    if (a.x != 0 && b.x == 0) return 0;
    if (a.x == 0 && b.x == 0) return 1;
    return (1.0 * a.y)/(1.0 * a.x) <= (1.0 * b.y)/(1.0 * b.x);
}
int main()
{
    n = read();
    for (int i = 1; i <= n; i++)
    {
        a[i].x = read();
    }
    for (int i = 1; i <= n; i++)
    {
        a[i].y = read();
        if (a[i].x == 0) {continue;}
        int tmp = gcd(abs(a[i].x), abs(a[i].y));
        a[i].x /= tmp, a[i].y /= tmp;
    }
    std :: sort(a + 1, a + n + 1, cmp);
    int mx = 0, now = 1;
    for(int i = 2; i <= n; i++)
    {
        if (a[i].x == a[i - 1].x && a[i].y == a[i - 1].y) now++, mx = std :: max(now, mx);
        else now = 1;
    }
    printf("%d", mx);
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<cmath>
typedef long long ll;
ll read(ll x = 0, ll fr = 1, char ch = getchar())
{
    while (ch < '0'|| ch > '9') {if (ch == '-') fr = -1; ch = getchar();}
    while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    return x * fr;
}
using namespace std;
int n;
struct data
{
    int x, y;

	bool operator<(const data b) const
	{
		if (x == b.x) return y < b.y;
        else
        {
             return x < b.x;
        }

	}
}a[200050];
int gcd(int a, int b){if (a % b == 0) return b;else return gcd(b, a % b);}
std :: map<data, int>mp;
int main()
{
    n = read();
    int s1 = 0;
    for (int i = 1; i <= n; i++) a[i].x = read();
    for (int i = 1; i <= n; i++)
    {
        a[i].y = read();
        if (a[i].x != 0 && a[i].y != 0)
        {
            int tmp = gcd(abs(a[i].x), abs(a[i].y));
            a[i].x /= tmp, a[i].y /= tmp;
        }
        if (a[i].x < 0) a[i].x *= -1, a[i].y *= -1;
        if (a[i].y == 0) s1++;
        mp[a[i]]++;
    }
    int mx = s1;
    for(int i = 1; i <= n; i++)
    {
        if (a[i].x == 0 && a[i].y != 0) continue;
        mx = max(mx, mp[a[i]]);
    }
    printf("%d", mx);
    return 0;
}
/*
7
1 2 1 1 2 3 0
6 12 -6 0 0 0 0

*/


#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<cmath>
typedef long long ll;
ll read(ll x = 0, ll fr = 0, char ch = getchar())
{
    while (ch < '0'|| ch > '9') {if (ch == '-') fr = -1; ch = getchar();}
    while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
    return x;
}
using namespace std;
int n;
struct data
{
    int x, y;
}a[200050];
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}
bool cmp(data a, data b)
{
    if (a.x == 0 && b.x != 0) return 1;
    if (a.x != 0 && b.x == 0) return 0;
    if (a.x == 0 && b.x == 0) return 1;
    return (1.0 * a.y)/(1.0 * a.x) <= (1.0 * b.y)/(1.0 * b.x);
}
int main()
{
    n = read();
    for (int i = 1; i <= n; i++)
        a[i].x = read();
    for (int i = 1; i <= n; i++)
    {
        a[i].y = read();
        if (a[i].x == 0) {continue;}
        int tmp = gcd(abs(a[i].x), abs(a[i].y));
        a[i].x /= tmp, a[i].y /= tmp;
        if (a[i].x < 0 && a[i].y > 0) a[i].x *= -1, a[i].y *= -1;
    }
    std :: sort(a + 1, a + n + 1, cmp);
    int mx = 0, now = 1;
    for(int i = 2; i <= n; i++)
    {
        if (a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)
            now++, mx = std :: max(now, mx);
        else now = 1;
    }
    printf("%d", mx);
    return 0;
}


#include<cstdio>
#include<cctype>
#include<algorithm>

int n, g, t, dr, cnt = 1, maxans;
int a[200002], b[200002], c[200002];
struct node
{
	int fz;
	int fm;
}p[200002];

inline int gcd(int x, int y)
{
	return !y ? x : gcd(y, x % y);
}

inline bool equ(node x, node y)
{
	if(x.fm == y.fm && x.fz == y.fz) return true;
	return false;
}

inline bool cmp(node x, node y)
{
	return x.fm < y.fm;
}

inline int readin()
{
	int x = 0;
	bool shit = false;
	char ch = getchar();
	for(;!isdigit(ch); ch = getchar()) (ch == '-') && (shit = true);
	for(; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
	return shit ? -x : x;
}

int main()
{
	n = readin();
	for(int i = 1; i <= n; ++i) p[i].fm = readin();
	for(int i = 1; i <= n; ++i)
	{
		p[i].fz = readin();
		g = gcd(p[i].fm, p[i].fz);
		if(!g) ++dr;
		else p[i].fz /= g, p[i].fm /= g;
	}
	std::sort(p + 1, p + n + 1, cmp);
	for(int i = 2; i <= n; ++i)
	{
		if(p[i].fm)
		{
			if(equ(p[i], p[i - 1])) ++cnt, maxans = maxans < cnt ? cnt : maxans;
			else maxans = maxans < cnt ? cnt : maxans, cnt = 1;
		}
	}
	printf("%d", maxans + dr);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#define long long int
using namespace std;
map <pair<int,int>,int> m;
const int inf=200005;
int a[inf],b[inf];
int cnt=0;
inline int gcd(int a,int b){
	while(b){
		swap(a,b);
		b%=a;
	}
	return a;
}
int ans,freeans;
inline void judge(const int i){
	int d=gcd(abs(b[i]),abs(a[i]));
    b[i]/=d;a[i]/=d;
    if(a[i]==0 && b[i]==0){
    	freeans++;
		return;
	}
    if(a[i]==0)return;
    ans=max(ans,++m[make_pair(b[i],a[i])]);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++){

		b[i]*=-1;
        if(b[i]<0){b[i]*=-1;a[i]*=-1;}
        else if(!b[i]&&a[i]<0)a[i]*=-1;
	}
	for(int i=1;i<=n;i++)judge(i);
	cout<<ans+freeans;
	return 0;
}


#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
map<double, int> m;
int n, maxans;
double a[200002], b[200002], c[200002];
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%lf", &a[i]);
	for(int i = 1; i <= n; ++i) scanf("%lf", &b[i]);
	for(int i = 1; i <= n; ++i) if(a[i] != 0.0) ++m[-b[i] / a[i]];
	for(int i = 1; i <= n; ++i) if(a[i] != 0.0) maxans = maxans < m[-b[i] / a[i]] ? m[-b[i] / a[i]] : maxans;
	printf("%d", maxans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
map <pair<int,int>,int> m;
const int inf=200005;
int a[inf],b[inf];
int cnt=0;
inline int gcd(int a,int b){
	while(b){
		swap(a,b);
		b%=a;
	}
	return a;
}
int ans,freeans;
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++){
	    if(a[i]==0 && b[i]==0){
	    	freeans++;
			continue;
		}
	    if(a[i]==0)continue;
	    b[i]*=-1;
        if(b[i]<0){b[i]*=-1;a[i]*=-1;}
        else if(!b[i]&&a[i]<0)a[i]*=-1;
		int d=gcd(abs(b[i]),abs(a[i]));
	    b[i]/=d;a[i]/=d;
	    ans=max(ans,++m[make_pair(b[i],a[i])]);
	}
	cout<<ans+freeans;
	return 0;
}

//int main()
//{
//    int ans1=0,ans2=0,n,i;
//    cin>>n;
//    for(i=1;i<=n;i++)scanf("%d",&a[i]);
//    for(i=1;i<=n;i++)scanf("%d",&b[i]);//输入
//    for(i=1;i<=n;i++)
//     {if(a[i]==0&&b[i]==0)
//       ans1++;//若等于零则取什么值都可以
//      else if(!a[i])continue;//若系数为零则不存在
//      else
//      {
//        b[i]*=-1;//先乘
//        if(b[i]<0){b[i]*=-1;a[i]*=-1;}//若若小于零则让分子为正数
//         else if(!b[i]&&a[i]<0)a[i]*=-1;//若不影响b[i]则令a[i]为正数
//        int d=__gcd(abs(b[i]),abs(a[i]));//用c++自带函数求最大公因数
//        b[i]/=d;a[i]/=d;//约去公因子
//        ans2=max(ans2,++mp1[make_pair(b[i],a[i])]);//存储顺便判断
//      }
//     }
//    cout<<ans2+ans1<<endl;
//}


#include "iostream"
#include "cstdio"
#include "cmath"
#include "algorithm"
#include "cstring"
#include "map"
using namespace std;
typedef long long ll;
map<long double,ll> mp;
ll n,ans=0,sum=0;
ll a[200005];
ll b[200005];
int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]==0&&b[i]==0){
            mp[b[i]*1.0/a[i]]++;
            ans=max(ans,mp[b[i]*1.0/a[i]]);
        }else if(a[i]==0){
            continue;
        }else{
            mp[b[i]*1.0/a[i]]++;
            ans=max(ans,mp[b[i]*1.0/a[i]]);
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include<cstdio>
#include<cctype>
#include<algorithm>

int n, g, t, dr, cnt = 1, maxans;
int a[200002], b[200002], c[200002];
struct node
{
	int fz;
	int fm;
}p[200002];

inline int gcd(int x, int y)
{
	return !y ? x : gcd(y, x % y);
}

inline bool equ(node x, node y)
{
	if(x.fm == y.fm && x.fz == y.fz) return true;
	return false;
}

inline bool cmp(node x, node y)
{
	if(x.fm == y.fm) return x.fz > y.fz;
	return x.fm < y.fm;
}

inline int readin()
{
	int x = 0;
	bool shit = false;
	char ch = getchar();
	for(;!isdigit(ch); ch = getchar()) (ch == '-') && (shit = true);
	for(; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
	return shit ? -x : x;
}

int main()
{
	n = readin();
	for(int i = 1; i <= n; ++i) p[i].fm = readin();
	for(int i = 1; i <= n; ++i)
	{
		p[i].fz = readin();
		g = gcd(p[i].fm, p[i].fz);
		if(!g) ++dr;
		else p[i].fz /= g, p[i].fm /= g;
	}
	std::sort(p + 1, p + n + 1, cmp);
	for(int i = 2; i <= n; ++i)
	{
		if(p[i].fm)
		{
			if(equ(p[i], p[i - 1])) ++cnt, maxans = maxans < cnt ? cnt : maxans;
			else maxans = maxans < cnt ? cnt : maxans, cnt = 1;
		}
	}
	printf("%d", maxans + dr);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
map <long double,ll> t;
int main()
{
	int n;
	cin>>n;
	ll a[200005]={0},ans1=0,ans2=0;
	ld b[200005];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
		if(a[i]==0)
        {
            if(b[i]==0)
                ans2++;
            continue;
        }
        else
        t[(ld) b[i]/a[i]]++;
        ans2=max(ans2, t[(ld) b[i]/a[i]]);
	}
	ll ans=ans1+ans2;
	cout<<ans;

	return 0;
}


//#pragma GCC optimize(3)
//#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define memset(a) memset(a, 0, sizeof(a));
#define Buff ios::sync_with_stdio(false);
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;

map<pair<int, int>, int> mmp;
int a[N];

int main()
{
    Buff;
    int n; cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    int x1, x, maxv = 0;
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> x;
        if((x == 0 && a[i] == 0)) ans++;
        else if(a[i] != 0)
        {
            x1 = __gcd(abs(x), abs(a[i]));
            a[i] /= x1; x /= x1;
            if(a[i] < 0)
            {
                a[i] *= -1;
                x *= -1;
            }
            mmp[{a[i], x}]++;
            //cout << mmp[{a[i], x}] << endl;
            //maxv = max(maxv, mmp[{a[i],x}]);
        }
    }
    map<pair<int, int>, int>::iterator iter;
    for(iter = mmp.begin(); iter != mmp.end(); iter++)
    {
        maxv = max(maxv, iter->second);
    }
    cout << maxv + ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
int a[MAXN],b[MAXN];
int n;
struct fs
{
	long long a,b;
}f[MAXN];
int cmp(fs i,fs j)
{
	return i.a*j.b<j.a*i.b;
}
int main()
{
	int i,j,k;
	cin>>n;
	for(i=1;i<=n;i++) cin>>f[i].a;
	for(i=1;i<=n;i++) cin>>f[i].b;
	sort(f+1,f+n+1,cmp);
	int maxx=0,s=0;
	for(i=1;i<=n;i++){
	if(f[i].a&&f[i].a*f[i-1].b==f[i].b*f[i-1].a) s++;
	else if(!f[i].a) s=0;
	else{
		maxx=max(maxx,s);
		s=1;
	}
	}
	maxx=max(maxx,s);
	cout<<maxx;
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n, g, t, cnt = 1, maxans;
int a[200002], b[200002], c[200002];
struct node
{
	int fz;
	int fm;
}p[200002];

int gcd(int x, int y)
{
	return !y ? x : gcd(y, x % y);
}

bool equ(node x, node y)
{
	if(x.fm == y.fm && x.fz == y.fz) return true;
	return false;
}

bool cmp(node x, node y)
{
	return x.fm < y.fm;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &p[i].fm);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d", &p[i].fz);
		if(p[i].fm) g = gcd(p[i].fm, p[i].fz), p[i].fz /= g, p[i].fm /= g;
	}
	sort(p + 1, p + n + 1, cmp);
	for(int i = 2; i <= n; ++i)
	{
		if(p[i].fm)
		{
			if(equ(p[i], p[i - 1])) ++cnt, maxans = maxans < cnt ? cnt : maxans;
			else cnt = 1;
		}
	}
	printf("%d", maxans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200005];
map<long double,ll> q;
int main()
{
	ll num,zero=0;
	cin>>num;
	ll sum=0;
	for(int i=1;i<=num;i++)
		scanf("%lld",&a[i]);
	long double b;
	for(int i=1;i<=num;i++)
	{
		cin>>b;
		if(a[i]==0)
		{
			if(b==0)
				zero++;
			else
				continue;
		}
		q[b/a[i]]++;
		sum=max(sum,q[b/a[i]]);
	}
	cout<<sum+zero;
}


#include<bits/stdc++.h>
using namespace std;
int a[200005];
int b[200005];
struct node
{
    int x,y;
};
int main()
{
    map<pair<int,int>,int>mp;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        cin>>b[i];
    int ans=0,anss=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==0&&b[i]==0)
        {
            ans++;
        }
        else if(a[i]==0)
            continue;
        else
        {
            b[i]*=-1;
            if(b[i]<0)
            {
                b[i]*=-1;
                a[i]*=-1;
            }
            else
                if(!b[i]&&a[i]<0)
                a[i]*=-1;
            int x=__gcd(abs(a[i]),abs(b[i]));
            a[i]/=x,b[i]/=x;
            anss=max(anss,++mp[make_pair(b[i],a[i])]);
        }
    }
    cout<<ans+anss<<endl;
    return 0;
}


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

long double A[200005], B[200005];
map<long double, int> m;

int main()
{
	int n, ans = 0x81234567, addic = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%Lf", &A[i]);
	for (int i = 0; i < n; ++i)
		scanf("%Lf", &B[i]);

	for (int i = 0; i < n; ++i)
	{
		if (A[i] == 0.0)
		{
			if (B[i] == 0.0)
				++addic;
			continue;
		}
		++m[B[i] / A[i]];
	}

	for (auto i : m)
		ans = max(ans, i.second);
	printf("%d\n", ans + addic);
	return 0x81234567 & 0;
}


#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
map<long double, int> m;
int n, maxans;
long double a[200002], b[200002], c[200002];
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%llf", &a[i]);
	for(int i = 1; i <= n; ++i) scanf("%llf", &b[i]);
	for(int i = 1; i <= n; ++i) if(a[i] != 0.0) ++m[-b[i] / a[i]];
	for(int i = 1; i <= n; ++i) if(a[i] != 0.0) maxans = maxans < m[-b[i] / a[i]] ? m[-b[i] / a[i]] : maxans;
	printf("%d", maxans);
	return 0;
}


#include<algorithm>
#include<cstdio>
#define dd double
using namespace std;
const int N=2e5+5;
int a[N];
dd c[N]={-6e9};
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
inline int read(){
	char ch=getchar();
	int x=0,f=1;
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	return x*f;
}
int main(){
	int n=read(),num=0,ans=0,cnt=0,x;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++){
		x=read();
		if(!a[i]&&!x) c[i]=-c[0],num++;
		else if(!a[i]) c[i]=c[0],++cnt;
		else c[i]=-(dd)x/a[i];
	}
	if(cnt==n){printf("0\n");return 0;}
	if(num+cnt==n) num=0;
	else num=1;
	sort(c+1,c+n+1);
	for(int i=1;i<=n;i++){
		if(c[i]==c[0]) continue;
		else if(c[i]==-c[0]){cnt=n-i+1;break;}
		if(c[i]==c[i-1]) ++num;
		else ans=max(ans,num),num=1;
	}
	ans=max(ans,num);
	printf("%d\n",min(n,ans+cnt));
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int inf=100005;
long long res[inf];
long long a[inf],b[inf];
struct node{
	long long up,down;
};
int cnt=0;
inline void judge(const int i){
	int x;
	res[++cnt]=x=(a[i]*1000)/(b[i]);
}
long long ans;
int main(){
	int n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)scanf("%lld",&b[i]);
	for(int i=1;i<=n;i++)judge(i);
	sort(res+1,res+n+1);
	int k=1;
	for(int i=1;i<=n;i++){
		if(res[i]==res[i-1])k++;
		else {
			ans=k;
			k=1;
		}
	}
	if(k>ans)cout<<k;
	else cout<<ans;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn = 200001;
int n, m, i, s, k;
struct node
{
	int x;
	double y;
}f[maxn];
inline int read()
{
	int x = 0, k = 0;
	char ch = getchar();
	while (ch < '0' || ch>'9')
	{
		if (ch == '-') k = 1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	if (k == 1) x = -x;
	return x;
}
inline bool cmp(node a, node b)
{
	return a.y < b.y;
}
int main()
{
	n = read();
	for (i = 1; i <= n; i++) f[i].x = read();
	for (i = 1; i <= n; i++) f[i].y = read();
	m = s = k = 0;
	for (i = 1; i <= n; i++)
		if (f[i].x != 0) f[i].y = -f[i].y / f[i].x;
		else
		{
			if (fabs(f[i].y) < 1e-6) ++m;
			f[i].y = 1e9 + 1;
		}
	sort(f + 1, f + n + 1, cmp);
	for (i = 1; i <= n; i++)
		if (f[i].x == 0) break;
		else
		{
			if (i == 1)
			{
				k = 1;
				continue;
			}
			if (fabs(f[i].y - f[i - 1].y) < 1e-6) ++k;
			else
			{
				if (k > s) s = k;
				k = 1;
			}
		}
	if (k > s) s = k;
	s += m;
	printf("%d", s);
	return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
double a[200005]={0},b[200005]={0};
double c[200005];
double d=10000000000000;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%lf",&a[i]);
    for(int i=0;i<n;i++)
        scanf("%lf",&b[i]);
    for(int i=0;i<n;i++)
    {
        if(a[i]!=0)
        {
            c[i]=b[i]/a[i];
            c[i]=-c[i];
        }
        else if(b[i]!=0)
        {
            c[i]=d;
        }
        else
            c[i]=0;
    }
    sort(c,c+n);
    int minn=-10000000;
    int flag=1,q=0;
    for(int i=0;i<n;i++)
        if(c[i]==d)
        q++;
    for(int i=0;i<n;i++)
    {
        if(c[i]==c[i+1]&&c[i]!=d)
        {
            flag++;
        }
        else
        {
            if(minn<flag)
                minn=flag;
            flag=1;
        }
    }
    if(flag>n)
        minn=n;
    if(q==n)
        minn=0;
    printf("%d\n",minn);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#define long long int
using namespace std;
map <pair<int,int>,int> m;
const int inf=200005;
int a[inf],b[inf];
int cnt=0;
inline int gcd(int a,int b){
	while(b){
		swap(a,b);
		b%=a;
	}
	return a;
}
int ans,freeans;
inline void judge(const int i){
	int d=gcd(abs(b[i]),abs(a[i]));
    b[i]/=d;a[i]/=d;
    if(a[i]==0 && b[i]==0){
    	freeans++;
		return;
	}
    if(a[i]==0)return;
    ans=max(ans,++m[make_pair(b[i],a[i])]);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	for(int i=1;i<=n;i++){
		b[i]*=-1;
        if(b[i]<0){b[i]*=-1;a[i]*=-1;}
        else if(!b[i]&&a[i]<0)a[i]*=-1;
	}
	for(int i=1;i<=n;i++){
		int d=gcd(abs(b[i]),abs(a[i]));
	    b[i]/=d;a[i]/=d;
	    if(a[i]==0 && b[i]==0){
	    	freeans++;
			return;
		}
	    if(a[i]==0)return;
	    ans=max(ans,++m[make_pair(b[i],a[i])]);
	}
	cout<<ans+freeans;
	return 0;
}


#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
#include<string.h>
#include<map>
long double b[200005],a[200005];
map<long double,int>cnt;
int main()
{
    int n,i,j,maxx=0,cnt2=0;
    cin>>n;
    for(i=1; i<=n; i++)
        cin>>a[i];
    //long double输入输出用Lf？但是我写的时候输出乱码 所以跟原博主一样用cin了..c++真的可以解决好多问题
    for(i=1; i<=n; i++)
    {
        cin>>b[i];//为什么之前的写法会tle 后来换了continue也t了。。
        if (a[i] == 0)
        {
            if (b[i] == 0)
                cnt2++;
            continue;
        }
        long double d=b[i]/a[i];
        cnt[d]++;
        if(cnt[d]>maxx)
            maxx=cnt[d];
    }
    cout<<maxx+cnt2<<endl;
    return 0;
}


#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<map>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
LL a[maxn],b[maxn];
int main(void)
{
//  cin.tie(0);std::ios::sync_with_stdio(false);
  map<long double,LL>map1;
  LL n;cin>>n;
  LL sum=0;LL cnt=0;
  for(LL i=1;i<=n;i++) cin>>a[i];
  for(LL i=1;i<=n;i++) cin>>b[i];
  for(LL i=1;i<=n;i++){
  	if(a[i]!=0){
  	long double c=(-1*1.0)*b[i]/a[i];
	map1[c]++;
	}
	if(a[i]==0&&b[i]==0) cnt++;
  }
  for(map<long double,LL>::iterator it=map1.begin();it!=map1.end();it++){
  	 sum=max(sum,it->second);
  }
  cout<<sum+cnt<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
	}
	int temp=0;
	for(int i=0;i<n;i++)
	{
		c[i]=(float)b[i]/a[i];
		if(a[i]==0&&b[i]!=0)
		temp++;
	}
	sort(c,c+n);
	for(int i=0;i<n;i++)
	{
		if(a[i]==0&&b[i]!=0)
		c[i]=c[0]-1;
	}
	sort(c,c+n);
	int dem=1,max=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]==c[i+1])
		{
			dem++;
		}
		else
		{
			if(dem>=max)
			{
				max=dem;
				dem=1;
			}
		}
	}
	cout << max-temp;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
long double c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(long double)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=1;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            if(dem>=temp11)
                temp11=dem;
            dem=1;
        }
    }
    cout << temp+temp11;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
	}
	int temp=0;
	for(int i=0;i<n;i++)
	{
		c[i]=(float)b[i]/a[i];
		if(a[i]==0)
		temp++;
	}
	sort(c,c+n);
	int dem=1,max=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]==c[i+1])
		{
			dem++;
		}
		else
		{
			if(dem>=max)
			{
				max=dem;
				dem=1;
			}
		}
	}
	cout << max-temp;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    for(int i=0;i<n;i++)
    {
        c[i]=(float)b[i]/a[i];
    }
    int temp=0,temp1=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        if(a[i]==0&&b[i]!=0)
            temp1++;
    }

    int dem=1,max1=0;
    for(int i=0;i<n;i++)
    {
        if(c[i]==c[i+1])
        {
            dem++;
        }
        else
        {
            if(dem>=max1)
                {
                    max1=dem;
                    dem=1;
                }
        }

    }
    cout << max1+temp-temp1;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
	}
	int temp=0;
	for(int i=0;i<n;i++)
	{
		c[i]=(float)b[i]/a[i];
		if(a[i]==0&&b[i]!=0)
		temp++;
	}
	sort(c,c+n);int tg1=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]==0&&b[i]!=0)
		{
			c[i]=c[0]-1;
		}
		tg1=c[0]-1;
	}
	sort(c,c+n);
	int dem=1,max=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]==c[i+1]&&c[i]!=tg1)
		{
			dem++;
		}
		else
		{
			if(dem>=max)
			{
				max=dem;
				dem=1;
			}
		}
	}
	if(temp>0)
	cout << max-temp;
	else
	cout << max;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
long double c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(long double)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=0;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            if(dem>=temp11)
                temp11=dem;
            dem=1;
        }
    }
    cout << temp+temp11;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(float)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=0;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            temp11=max(temp11,dem);
            dem=1;
        }
    }
    cout << temp+temp11;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
long double c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(long double)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=0;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            if(dem>=temp11)
                temp11=dem;
            dem=1;
        }
    }
    if(k==1)
    cout << temp+1;
    else
        cout << temp+temp11;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
	}
	int temp=0;
	for(int i=0;i<n;i++)
	{
		c[i]=(float)b[i]/a[i];
		if(a[i]==0&&b[i]!=0)
		temp++;
	}
	sort(c,c+n);
	for(int i=0;i<n;i++)
	{
		if(a[i]==0&&b[i]!=0)
		c[i]=c[0]-1;
	}
	sort(c,c+n);
	int dem=1,max=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]==c[i+1]&&c[i+1]!=c[0])
		{
			dem++;
		}
		else
		{
			if(dem>=max)
			{
				max=dem;
				dem=1;
			}
		}
	}

	if(temp>0)
	cout << max-1;
	else
	cout << max;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
double c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(double)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=0;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            if(dem>=temp11)
                temp11=dem;
            dem=1;
        }
    }
    cout << temp+temp11;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
float c[200000];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int i=0;i<n;i++)
	{
		cin >> b[i];
	}
	int temp=0;
	for(int i=0;i<n;i++)
	{
		c[i]=(float)b[i]/a[i];
		if(a[i]==0&&b[i]!=0)
		temp++;
	}
	sort(c,c+n);
	int dem=1,max=0;
	for(int i=0;i<n;i++)
	{
		if(c[i]==c[i+1])
		{
			dem++;
		}
		else
		{
			if(dem>=max)
			{
				max=dem;
				dem=1;
			}
		}
	}
	cout << max-temp;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[200000];
int b[200000];
long double c[200000];
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    int temp=0,k=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0&&b[i]==0)
            temp++;
        else
            if(a[i]!=0)
        {
            c[k]=(long double)b[i]/a[i];
            k++;
        }
    }
    sort(c,c+k);
    int dem=1,temp11=0;
    for(int i=0;i<k;i++)
    {
        if(c[i]==c[i+1])
            dem++;
        else
        {
            if(dem>=temp11)
                temp11=dem;
            dem=1;
        }
    }
    if(k>1)
    cout << temp+temp11;
    else
        cout << temp+1;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,pair<int,int> > ff[200005];

bool cmp(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
    {
        scanf("%d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    int cc=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }
            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    int cc0=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<long long,pair<long long,long long> > ff[200005];

bool cmp(pair<long long,pair<long long,long long> >a,pair<long long,pair<long long,long long> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

long long gcd(long long a,long long b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        long long t=a;
        a=b;
        b=t;
    }
    long long t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(long long i=0; i<n; i++)
        scanf("%I64d",&ff[i].first);

    for(long long i=0; i<n; i++)
    {
        scanf("%I64d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    long long cc=0;
    for(long long i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            long long g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=-g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }

            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }

            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    /*for(int i=0;i<n;i++)
    {
        cout<<ff[i].first<<' ';
    }
    cout<<endl;

    for(int i=0;i<n;i++)
    {
        cout<<ff[i].second.first<<' ';
    }
    cout<<endl;

    for(int i=0;i<n;i++)
    {
        cout<<flag[ff[i].second.second]<<' ';
    }
    cout<<endl;*/

    long long cc0=1;
    long long Max=0;
    for(long long i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
        else
        {
            Max=max(Max,cc0-1);
                cc0=1;
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000000
int ff[200005];
int yy[200005];
double sub[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%d",&yy[i]);

    for(int i=0; i<n; i++)
        sub[i]=yy[i]-ff[i];

    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            sub[i]=sub[i]/ff[i];
        else
            sub[i]=INF;
    }

    sort(sub,sub+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(sub[i]==sub[i+1])
        {
            cc++;
        }
        else
        {
            if(sub[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    if(sub[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,pair<int,int> > ff[200005];

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
    {
        scanf("%d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    int cc=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
                cc++;
            flag[ff[i].second.second]=true;
        }
    }

    sort(ff,ff+n);

    int cc0=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000000
int ff[200005];
int yy[200005];
double sub[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%d",&yy[i]);

    for(int i=0; i<n; i++)
        sub[i]=yy[i]-ff[i];

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            sub[i]=sub[i]/ff[i];
        else
        {
            if(sub[i]==0)
               cc0++;
            sub[i]=INF;

        }

    }

    sort(sub,sub+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(sub[i]==sub[i+1])
        {
            cc++;
        }
        else
        {
            if(sub[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    if(sub[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<long long,pair<long long,long long> > ff[200005];

bool cmp(pair<long long,pair<long long,long long> >a,pair<long long,pair<long long,long long> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

long long gcd(long long a,long long b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        long long t=a;
        a=b;
        b=t;
    }
    long long t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(long long i=0; i<n; i++)
        scanf("%I64d",&ff[i].first);

    for(long long i=0; i<n; i++)
    {
        scanf("%I64d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    long long cc=0;
    for(long long i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            long long g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=-g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }

            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }

            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    /*cout<<endl;
    for(int i=0;i<n;i++)
    {
        cout<<ff[i].first<<' ';
    }
    cout<<endl;

    for(int i=0;i<n;i++)
    {
        cout<<ff[i].second.first<<' ';
    }
    cout<<endl;

    for(int i=0;i<n;i++)
    {
        cout<<flag[ff[i].second.second]<<' ';
    }
    cout<<endl;*/

    long long cc0=1;
    long long Max=0;
    for(long long i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }

        if(flag[ff[i+1].second.second]==true&&(ff[i+1].first!=0||ff[i+1].second.first!=0))
        {
            Max=max(Max,cc0-1);
                 cc0=1;
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,pair<int,int> > ff[200005];

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
    {
        scanf("%d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    int cc=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
                cc++;
            flag[ff[i].second.second]=true;
        }
    }

    sort(ff,ff+n);

    int cc0=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[n-1]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,pair<int,int> > ff[200005];

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
    {
        scanf("%d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    int cc=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
                cc++;
            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[ff[i].second.second]=true;
            }

        }
    }

    sort(ff,ff+n);

    int cc0=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005
double ff[200005];
double yy[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%llf",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%llf",&yy[i]);

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            yy[i]=-yy[i]/ff[i];
        else
        {
            if(yy[i]==0)
               cc0++;
            yy[i]=INF;
        }
    }

    sort(yy,yy+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(yy[i]==yy[i+1])
        {
            cc++;
        }
        else
        {
            if(yy[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    if(yy[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;

    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005
long long ff[200005];
long long yy[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%I64d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%I64d",&yy[i]);

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            yy[i]=-yy[i]*1000000000/ff[i];
        else
        {
            if(yy[i]==0)
               cc0++;
            yy[i]=INF*INF;
        }
    }

    sort(yy,yy+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(yy[i]==yy[i+1])
        {
            cc++;
        }
        else
        {
            if(yy[i]!=INF*INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    /*for(int i=0;i<n;i++)
    {
        printf("%lld ",yy[i]);
    }
    cout<<endl;*/
    if(yy[n-1]!=INF*INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;

    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000000
int ff[200005];
int yy[200005];
double sub[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%d",&yy[i]);

    for(int i=0; i<n; i++)
        sub[i]=yy[i]-ff[i];

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            sub[i]=sub[i]/ff[i];
        else
        {
            if(sub[i]!=0)
            sub[i]=INF;
            else
               cc0++;
        }

    }

    sort(sub,sub+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(sub[i]==sub[i+1])
        {
            cc++;
        }
        else
        {
            if(sub[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    if(sub[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<long long,pair<long long,long long> > ff[200005];

bool cmp(pair<long long,pair<long long,long long> >a,pair<long long,pair<long long,long long> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

long long gcd(long long a,long long b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        long long t=a;
        a=b;
        b=t;
    }
    long long t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(long long i=0; i<n; i++)
        scanf("%I64d",&ff[i].first);

    for(long long i=0; i<n; i++)
    {
        scanf("%I64d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    long long cc=0;
    for(long long i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            long long g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            ff[i].second.first=-ff[i].second.first;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }

            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    long long cc0=1;
    long long Max=0;
    for(long long i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,pair<int,int> > ff[200005];

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
    {
        scanf("%d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    int cc=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0)
                cc++;
            flag[ff[i].second.second]=true;
        }
    }

    sort(ff,ff+n);

    int cc0=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<long long,pair<long long,long long> > ff[200005];

bool cmp(pair<long long,pair<long long,long long> >a,pair<long long,pair<long long,long long> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

long long gcd(long long a,long long b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        long long t=a;
        a=b;
        b=t;
    }
    long long t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(long long i=0; i<n; i++)
        scanf("%I64d",&ff[i].first);

    for(long long i=0; i<n; i++)
    {
        scanf("%I64d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    long long cc=0;
    for(long long i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            long long g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=-g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }

            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    long long cc0=1;
    long long Max=0;
    for(long long i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<int,int> ff[200005];

int gcd(int a,int b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        int t=a;
        a=b;
        b=t;
    }
    int t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].first);

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i].second);

    int cc=0;
    for(int i=0;i<n;i++)
    {
        if(ff[i].second!=0&&ff[i].first!=0)
        {
            int g=gcd(ff[i].first,ff[i].second);
            ff[i].first/=g;
            ff[i].second/=g;
            if(ff[i].second<0&&ff[i].first<0)
            {
                ff[i].second=-ff[i].second;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second=-ff[i].second;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second==0)
                cc++;
            flag[i]=true;
        }
    }

    sort(ff,ff+n);

    int cc0=1;
    int Max=0;
    for(int i=0;i<n-1;i++)
    {
        if(flag[i]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second==ff[i+1].second)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[n-1]==false)
    Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005
int ff[200005];
int yy[200005];
double sub[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%d",&yy[i]);

    for(int i=0; i<n; i++)
        sub[i]=yy[i]-ff[i];

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            sub[i]=sub[i]/ff[i];
        else
        {
            if(sub[i]==0)
               cc0++;
            sub[i]=INF;

        }

    }

    sort(sub,sub+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(sub[i]==sub[i+1])
        {
            cc++;
        }
        else
        {
            if(sub[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    if(sub[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005
float ff[200005];
float yy[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%f",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%f",&yy[i]);

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            yy[i]=-yy[i]/ff[i];
        else
        {
            if(yy[i]==0)
               cc0++;
            yy[i]=INF;
        }
    }

    sort(yy,yy+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(yy[i]==yy[i+1])
        {
            cc++;
        }
        else
        {
            if(yy[i]!=INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    /*for(int i=0;i<n;i++)
    {
        printf("%f ",yy[i]);
    }
    cout<<endl;*/
    if(yy[n-1]!=INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;

    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005

bool flag[200005];
pair<long long,pair<long long,long long> > ff[200005];

bool cmp(pair<long long,pair<long long,long long> >a,pair<long long,pair<long long,long long> >b)
{
     if(a.first==b.first)
        return a.second.first<b.second.first;
     return a.first<b.first;
}

long long gcd(long long a,long long b)
{
    if(a<0)
        a=-a;
    if(b<0)
        b=-b;
    if(a>b)
    {
        long long t=a;
        a=b;
        b=t;
    }
    long long t=b%a;
    while(t!=0)
    {
        b=a;
        a=t;
        t=b%a;
    }
    return a;
}

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

    for(long long i=0; i<n; i++)
        scanf("%I64d",&ff[i].first);

    for(long long i=0; i<n; i++)
    {
        scanf("%I64d",&ff[i].second.first);
        ff[i].second.second=i;
    }

    long long cc=0;
    for(long long i=0; i<n; i++)
    {
        if(ff[i].second.first!=0&&ff[i].first!=0)
        {
            long long g=gcd(ff[i].first,ff[i].second.first);
            ff[i].first/=g;
            ff[i].second.first/=g;
            if(ff[i].second.first<0&&ff[i].first<0)
            {
                ff[i].second.first=-ff[i].second.first;
                ff[i].first=-ff[i].first;
            }
            if(ff[i].first>0&&ff[i].second.first<0)
            {
                ff[i].first=-ff[i].first;
                ff[i].second.first=-ff[i].second.first;
            }
        }
        else
        {
            if(ff[i].first==0&&ff[i].second.first==0)
            {
                cc++;
            }
            if(ff[i].second.first==0&&ff[i].first!=0)
            {
                ff[i].first=0;
                ff[i].second.first=0;
            }
            else
            {
                flag[i]=true;
            }

        }
    }

    sort(ff,ff+n,cmp);

    long long cc0=1;
    long long Max=0;
    for(long long i=0; i<n-1; i++)
    {
        if(flag[ff[i].second.second]==false)
        {
            if(ff[i].first==ff[i+1].first&&ff[i].second.first==ff[i+1].second.first)
            {
                cc0++;
            }
            else
            {
                Max=max(Max,cc0);
                cc0=1;
            }
        }
    }

    if(flag[ff[n-1].second.second]==false)
        Max=max(Max,cc0);

    cout<<Max+cc<<endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
using namespace std;
#define INF 2000000005LL
long long ff[200005];
long long yy[200005];
int main()
{
    int n;
    scanf("%d",&n);

    for(int i=0; i<n; i++)
        scanf("%I64d",&ff[i]);

    for(int i=0; i<n; i++)
        scanf("%I64d",&yy[i]);

    int cc0=0;
    for(int i=0; i<n; i++)
    {
        if(ff[i]!=0)
            yy[i]=-yy[i]*1000000000/ff[i];
        else
        {
            if(yy[i]==0)
               cc0++;
            yy[i]=INF*INF;
        }
    }

    sort(yy,yy+n);

    int cc=1;
    int Max=0;
    for(int i=0; i<n-1; i++)
    {
        if(yy[i]==yy[i+1])
        {
            cc++;
        }
        else
        {
            if(yy[i]!=INF*INF)
                Max=max(Max,cc);
            cc=1;
        }
    }

    /*for(int i=0;i<n;i++)
    {
        printf("%lld ",yy[i]);
    }
    cout<<endl;*/
    if(yy[n-1]!=INF*INF)
        Max=max(Max,cc);

    cout<<Max+cc0<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long int n,i,g,c=0;
  cin>>n;
  long int a[n]={0},b[n]={0};
  for(i=0;i<n;i++)
  cin>>a[i];
  for(i=0;i<n;i++)
  cin>>b[i];
  map<pair<long int,long int>,long int> mp;
  for(i=0;i<n;i++)
  {
    if(a[i]==0)
    {
      if(b[i]==0)
      {
        c++;
      }
    }
    else
    {
      pair<long int,long int> p=make_pair(-b[i],a[i]);
      if(p.x>0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      else if(p.x<0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      else if(p.x==0 && p.y<0)
      {
        p.y*=-1;
      }
      g=__gcd(abs(p.x),abs(p.y));
      p.x/=g;
      p.y/=g;
      mp[p]++;
    }
  }
  map<pair<long int,long int>,long int>::iterator itr;
  long int m=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m+c<<endl;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
  long int arr[200000],arr1[200000],n,i;
  map<float,long int> mp;
  cin>>n;
  for(i=0;i<n;i++)
  cin>>arr[i];
  for(i=0;i<n;i++)
  cin>>arr1[i];
  for(i=0;i<n;i++)
  {
    if(arr[i]!=0)
    mp[-(ceil((float)arr1[i]/arr[i]))]++;
  }
  map<float,long int>::iterator itr;
  long int m=0;
  //cout<<"The map is:\n";
  /*for(itr=mp.begin();itr!=mp.end();itr++)
  {
    cout<<itr->first<<" "<<itr->second<<"\n";
  }*/
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second

int main()
{
  long int n,i,g,c=0;
  cin>>n;
  long int a[n]={0},b[n]={0};
  for(i=0;i<n;i++)
  cin>>a[i];
  for(i=0;i<n;i++)
  cin>>b[i];
  map<pair<long int,long int>,long int> mp;
  for(i=0;i<n;i++)
  {
    if(a[i]==0)
    {
      if(b[i]==0)
      {
        c++;
      }
    }
    else
    {
      pair<long int,long int> p=make_pair(-b[i],a[i]);
      if(p.x<0)
      {
          p.x*=-1;
          p.y*=-1;
      }
      else if(p.x==0&&p.y<0)
      {
          p.y*=-1;
      }
      g=__gcd(abs(p.x),abs(p.y));
      p.x/=g;
      p.y/=g;
      mp[p]++;
    }
  }
  map<pair<long int,long int>,long int>::iterator itr;
  long int m=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m+c<<endl;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
  long int arr[200000],arr1[200000],n,i,c=0;
  map<float,long int> mp;
  cin>>n;
  for(i=0;i<n;i++)
  cin>>arr[i];
  for(i=0;i<n;i++)
  cin>>arr1[i];
  for(i=0;i<n;i++)
  {
    if(arr[i]!=0)
    {
       mp[-((float)arr1[i]/arr[i])]++;
    }
    else
    {
        if(arr1[i]==0)
          c++;
    }
  }
  map<float,long int>::iterator itr;
  long int m=0;
  //cout<<"The map is:\n";
  /*for(itr=mp.begin();itr!=mp.end();itr++)
  {
    cout<<itr->first<<" "<<itr->second<<"\n";
  }*/
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m+c;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long int n,i,g,c=0;
  cin>>n;
  long int a[n]={0},b[n]={0};
  for(i=0;i<n;i++)
  cin>>a[i];
  for(i=0;i<n;i++)
  cin>>b[i];
  map<pair<long int,long int>,long int> mp;
  for(i=0;i<n;i++)
  {
    if(a[i]==0)
    {
      if(b[i]==0)
      {
        c++;
      }
    }
    else
    {
      pair<long int,long int> p=make_pair(-b[i],a[i]);
      if(p.x<0)
      {
          p.x*=-1;
          p.y*=-1;
      }
      else if(p.x==0&&p.y<0)
      {
          p.y*=-1;
      }
      g=__gcd(abs(p.x),abs(p.y));
      p.x/=g;
      p.y/=g;
      mp[p]++;
    }
  }
  map<pair<long int,long int>,long int>::iterator itr;
  long int m=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m+c<<endl;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second

int main()
{
  long int n,i,g,c=0;
  cin>>n;
  long int a[n]={0},b[n]={0};
  for(i=0;i<n;i++)
  cin>>a[i];
  for(i=0;i<n;i++)
  cin>>b[i];
  map<pair<long int,long int>,long int> mp;
  for(i=0;i<n;i++)
  {
    if(a[i]==0)
    {
      if(b[i]==0)
      {
        c++;
      }
    }
    else
    {
      pair<long int,long int> p=make_pair(-b[i],a[i]);
      if(p.x>0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      else if(p.x<0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      g=__gcd(abs(p.x),abs(p.y));
      if((p.x==0 && p.y==0)&&g==0)
      {
          mp[{0,0}]++;
          continue;
      }
      p.x/=g;
      p.y/=g;
      mp[p]++;
    }
  }
  map<pair<long int,long int>,long int>::iterator itr;
  long int m=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m+c<<endl;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second

int main()
{
  long int n,i,g;
  cin>>n;
  long int a[n]={0},b[n]={0};
  for(i=0;i<n;i++)
  cin>>a[i];
  for(i=0;i<n;i++)
  cin>>b[i];
  map<pair<long int,long int>,long int> mp;
  for(i=0;i<n;i++)
  {
    if(a[i]==0)
    {
      if(b[i]==0)
      {
        mp[{0,0}]++;
      }
    }
    else
    {
      pair<long int,long int> p=make_pair(-b[i],a[i]);
      if(p.x>0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      else if(p.x<0 && p.y<0)
      {
        p.x*=-1;
        p.y*=-1;
      }
      g=_gcd(abs(p.x),abs(p.y));
      p.x/=g;
      p.y/=g;
      mp[p]++;
    }
  }
  map<pair<long int,long int>,long int>::iterator itr;
  long int m=0;
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m<<endl;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
  long int arr[200000],arr1[200000],n,i;
  map<float,long int> mp;
  cin>>n;
  for(i=0;i<n;i++)
  cin>>arr[i];
  for(i=0;i<n;i++)
  cin>>arr1[i];
  for(i=0;i<n;i++)
  {
    if(arr[i]!=0)
    mp[-((float)arr1[i]/arr[i])]++;
  }
  map<float,long int>::iterator itr;
  long int m=0;
  //cout<<"The map is:\n";
  /*for(itr=mp.begin();itr!=mp.end();itr++)
  {
    cout<<itr->first<<" "<<itr->second<<"\n";
  }*/
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m;
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
  long int arr[200000],arr1[200000],n,i;
  map<float,long int> mp;
  cin>>n;
  for(i=0;i<n;i++)
  cin>>arr[i];
  for(i=0;i<n;i++)
  cin>>arr1[i];
  for(i=0;i<n;i++)
  {
    mp[-((float)arr1[i]/arr[i])]++;
  }
  map<float,long int>::iterator itr;
  long int m=0;
  //cout<<"The map is:\n";
  /*for(itr=mp.begin();itr!=mp.end();itr++)
  {
    cout<<itr->first<<" "<<itr->second<<"\n";
  }*/
  for(itr=mp.begin();itr!=mp.end();itr++)
  {
    m=max(m,itr->second);
  }
  cout<<m;
  return 0;
}


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

#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 5e5 + 5, K = 5005, INF = 1e9;
int dp[2][K][2], t[N], a[N], b[N];

void upd(int &x, int y) {
    x = min(x, y);
}

signed main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int k, n;
    cin >> k >> n;

    for (int i = 0; i < n; i++) {
        cin >> t[i];
        a[i] = i;
    }

    sort(t, t + n);
    sort(a, a + n - 1, [=](int x, int y) {
        return t[x + 1] - t[x] < t[y + 1] - t[y];
    });

    set<int> st;

    for (int i = 0; i < 2 * k; i++) {
        st.insert(t[a[i]]);
        st.insert(t[a[i] + 1]);
    }

    int m = 0;

    for (int i : st) {
        b[m++] = i;
    }

    for (int i = 0; i < m - 1; i++) {
        b[i] = b[i + 1] - b[i];
    }

    m--;

    for (int i = 0; i <= k; i++)
        dp[0][i][0] = dp[0][i][1] = INF;

    dp[0][0][0] = 0;

    for (int i = 0; i < m; i++) {
        int p = i & 1;
        for (int j = 0; j <= k; j++) {
            dp[p ^ 1][j][0] = dp[p ^ 1][j][1] = INF;
        }
        for (int j = 0; j <= k; j++) {
            upd(dp[p ^ 1][j][0], dp[p][j][0]);
            upd(dp[p ^ 1][j + 1][1], dp[p][j][0] + b[i]);
            upd(dp[p ^ 1][j][0], dp[p][j][1]);
        }
    }

    cout << min(dp[m & 1][k][0], dp[m & 1][k][1]);

    return 0;
}


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

#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 5e5 + 5, K = 5005, INF = 1e9;
int dp[2][K][2], t[N], a[N], b[N];

void upd(int &x, int y) {
    x = min(x, y);
}

signed main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int k, n;
    cin >> k >> n;

    for (int i = 0; i < n; i++) {
        cin >> t[i];
        a[i] = i;
    }

    sort(t, t + n);
    sort(a, a + n - 1, [=](int x, int y) {
        return t[x + 1] - t[x] < t[y + 1] - t[y];
    });

    set<int> st;

    for (int i = 0; i < 2 * k - 1; i++) {
        st.insert(t[a[i]]);
        st.insert(t[a[i] + 1]);
    }

    int m = 0;

    for (int i : st) {
        b[m++] = i;
    }

    m--;

    for (int i = 0; i < m; i++) {
        b[i] = b[i + 1] - b[i];
    }

    for (int i = 0; i <= k; i++)
        dp[0][i][0] = dp[0][i][1] = INF;

    dp[0][0][0] = 0;

    for (int i = 0; i < m; i++) {
        int p = i & 1;
        for (int j = 0; j <= k; j++) {
            dp[p ^ 1][j][0] = dp[p ^ 1][j][1] = INF;
        }
        for (int j = 0; j <= k; j++) {
            upd(dp[p ^ 1][j][0], dp[p][j][0]);
            upd(dp[p ^ 1][j + 1][1], dp[p][j][0] + b[i]);
            upd(dp[p ^ 1][j][0], dp[p][j][1]);
        }
    }

    cout << min(dp[m & 1][k][0], dp[m & 1][k][1]);

    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<algorithm>
#include<vector>
#define maxn 600005
#define inf (1<<30)
using namespace std;
typedef pair<int,int> data;
priority_queue<data,vector<data>,greater<data> >pq;
int a[maxn],ans;
int n,k,pre[maxn],nxt[maxn];
int main(){
    scanf("%d%d",&k,&n);
    for(int i=1;i<=n;++i)scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<n;++i)a[i]=a[i+1]-a[i],pq.push(data(a[i],i));
    for(int i=0;i<=n;++i)pre[i]=i-1,nxt[i]=i+1;
    a[0]=a[n]=inf,pre[0]=0,nxt[n]=0;
    for(int i=1;i<=k;++i){
        while(pq.size()&&a[pq.top().second]!=pq.top().first)pq.pop();
        if(pq.empty())break;
        data s=pq.top();pq.pop();
        ans+=s.first;
        int x=s.second;
        int l=pre[x],r=nxt[x];
        a[x]=l&&r?min(inf,a[l]+a[r]-a[x]):inf;
        pq.push(data(a[x],x));
        a[l]=a[r]=inf;
        nxt[pre[x]=pre[l]]=x;
        pre[nxt[x]=nxt[r]]=x;
    }
    printf("%d",ans);
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<algorithm>
#include<vector>
#define maxn 600005
#define inf (1<<30)
using namespace std;
typedef pair<int,int> data;
priority_queue<data,vector<data>,greater<data> >pq;
int a[maxn],ans;
int n,k,pre[maxn],nxt[maxn];
int main(){
    scanf("%d%d",&k,&n);
    for(int i=1;i<=n;++i)scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<n;++i)a[i]=a[i+1]-a[i],pq.push(data(a[i],i));
    for(int i=0;i<=n;++i)pre[i]=i-1,nxt[i]=i+1;
    a[0]=a[n]=inf,pre[0]=0,nxt[n]=0;
    for(int i=1;i<=k;++i){
        //while(pq.size()&&a[pq.top().second]!=pq.top().first)pq.pop();
        if(pq.empty())break;
        data s=pq.top();pq.pop();
        ans+=s.first;
        int x=s.second;
        int l=pre[x],r=nxt[x];
        a[x]=l&&r?min(inf,a[l]+a[r]-a[x]):inf;
        pq.push(data(a[x],x));
        a[l]=a[r]=inf;
        nxt[pre[x]=pre[l]]=x;
        pre[nxt[x]=nxt[r]]=x;
    }
    printf("%d",ans);
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], L[maxn], R[maxn], f[maxn], n, K;
LL ans, sum[maxn], S;

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
		L[i] = R[i] = i;
	}
	while (K--) {
		while (Q.size()) {
			now = Q.top(); Q.pop();
			//printf("# %d %d %d\n", now.l, now.r, now.val);
			if (now.l == now.r && (f[now.l] || f[now.l-1] || f[now.l+1])) continue;
			if (now.l != now.r && (L[now.r-1] != now.l+1 || R[now.l+1] != now.r-1
				|| f[now.l] || f[now.r] || f[now.l-1] || f[now.r+1])) continue;
			//puts("-1");
			break;
		}
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; f[now.l] = f[now.r] = 1;
		if (now.l >= 2 && f[now.l-2]) now.l = L[now.l-2];
		if (f[now.r+2]) now.r = R[now.r+2];
		L[now.r] = now.l; R[now.l] = now.r;
		if (2 <= now.l && now.r <= n-1) {
			now.l--; now.r++; S = 0;
			rep (i, 0, now.r-now.l)
				if (i&1) S += a[now.l+i];
			Q.push((node){now.l, now.r, sum[now.r] - sum[now.l-1] - S});
		}
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], f[maxn], n, K, cnt;
LL ans, sum[maxn], tot;

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;

	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
	}

	while (K--) {
		while (Q.size()) {
			now = Q.top(); Q.pop(); cnt = 0;
			rep (i, now.l, now.r) cnt += f[i];
			if (cnt == (now.r-now.l) / 2 && !f[now.l-1] && !f[now.r+1]) break;
		}
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; tot = 0;
		rep (i, 0, now.r-now.l) {
			f[now.l+i] = (i&1)^1;
			if (f[now.l+i]) tot += a[now.l+i];
		}

		while (3 <= now.l && f[now.l-2]) {
			now.l -= 2; tot += a[now.l];
		}
		while (now.r <= n-2 && f[now.r+2]) {
			now.r += 2; tot += a[now.r];
		}

		if (2 <= now.l && now.r <= n-1)
			Q.push((node){now.l-1, now.r+1, sum[now.r+1] - sum[now.l-2] - tot});
		if (3 <= now.l)
			Q.push((node){now.l-2, now.r, sum[now.r] - sum[now.l-3] - tot});
		if (now.r <= n-2)
			Q.push((node){now.l, now.r+2, sum[now.r+2] - sum[now.l-1] - tot});
	}
	printf("%I64d\n", ans);

	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], L[maxn], R[maxn], f[maxn], n, K;
LL ans, sum[maxn];

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
		L[i] = R[i] = i;
	}
	while (K--) {
		while (Q.size()) {
			now = Q.top(); Q.pop();
			//printf("# %d %d %d\n", now.l, now.r, now.val);
			if (now.l == now.r && (f[now.l] || f[now.l-1] || f[now.l+1])) continue;
			if (now.l != now.r && (L[now.r-1] != now.l+1 || R[now.l+1] != now.r-1
				|| f[now.l] || f[now.r] || f[now.l-1] || f[now.r+1])) continue;
			//puts("-1");
			break;
		}
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; f[now.l] = f[now.r] = 1;
		if (now.l >= 2 && f[now.l-2]) now.l = L[now.l-2];
		if (f[now.r+2]) now.r = R[now.r+2];
		L[now.r] = now.l; R[now.l] = now.r;
		if (2 <= now.l && now.r <= n-1)
			Q.push((node){now.l-1, now.r+1, sum[now.r+1] - sum[now.l-2] - now.val});
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], L[maxn], R[maxn], f[maxn], n, K;
LL ans, sum[maxn];

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
		L[i] = R[i] = i;
	}
	while (K--) {
		while (Q.size()) {
			now = Q.top(); Q.pop();
			//printf("# %d %d %d\n", now.l, now.r, now.val);
			if (now.l == now.r && (f[now.l] || f[now.l-1] || f[now.l+1])) continue;
			if (now.l != now.r && (L[now.r-1] != now.l+1 || R[now.l+1] != now.r-1
				|| f[now.l] || f[now.r] || f[now.l-1] || f[now.r+1])) continue;
			//puts("-1"); break;
		}
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; f[now.l] = f[now.r] = 1;
		if (now.l >= 2 && f[now.l-2]) now.l = L[now.l-2];
		if (f[now.r+2]) now.r = R[now.r+2];
		L[now.r] = now.l; R[now.l] = now.r;
		if (2 <= now.l && now.r <= n-1)
			Q.push((node){now.l, now.r, sum[now.r] - sum[now.l-1] - now.val});
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], f[maxn], n, K, cnt;
LL ans, sum[maxn], tot;

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
	}
	while (K--) {
		int fff = 0;
		while (Q.size()) {
			now = Q.top(); Q.pop(); cnt = 0;
			rep (i, now.l, now.r) cnt += f[i];
			if (cnt == (now.r-now.l) / 2 && !f[now.l-1] && !f[now.r+1]) break;
			if (Q.empty()) fff = 1;
		}
		if (fff) break;
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; tot = 0;
		rep (i, 0, now.r-now.l) {
			f[now.l+i] = (i&1)^1;
			if (f[now.l+i]) tot += a[now.l+i];
		}
		while (3 <= now.l && f[now.l-2]) {
			now.l -= 2; tot += a[now.l];
		}
		while (now.r <= n-2 && f[now.r+2]) {
			now.r += 2; tot += a[now.r];
		}
		if (2 <= now.l && now.r <= n-1 && !f[now.l-2] && !f[now.r+2])
			Q.push((node){now.l-1, now.r+1, sum[now.r+1] - sum[now.l-2] - tot});
		if (3 <= now.l && !f[now.l-3])
			Q.push((node){now.l-2, now.r, sum[now.r] - sum[now.l-3] - tot});
		if (now.r <= n-2 && !f[now.r+3])
			Q.push((node){now.l, now.r+2, sum[now.r+2] - sum[now.l-1] - tot});
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], L[maxn], R[maxn], f[maxn], n, K;
LL ans, sum[maxn];

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
		L[i] = R[i] = i;
	}
	while (K--) {
		while (Q.size()) {
			now = Q.top(); Q.pop();
			//printf("# %d %d %d\n", now.l, now.r, now.val);
			if (now.l == now.r && (f[now.l] || f[now.l-1] || f[now.l+1])) continue;
			if (now.l != now.r && (L[now.r-1] != now.l+1 || R[now.l+1] != now.r-1
				|| f[now.l] || f[now.r] || f[now.l-1] || f[now.r+1])) continue;
			//puts("-1");
			break;
		}
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; f[now.l] = f[now.r] = 1;
		if (now.l >= 2 && f[now.l-2]) now.l = L[now.l-2];
		if (f[now.r+2]) now.r = R[now.r+2];
		L[now.r] = now.l; R[now.l] = now.r;
		if (2 <= now.l && now.r <= n-1)
			Q.push((node){now.l, now.r, sum[now.r] - sum[now.l-1] - now.val});
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=int(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 500005;
struct node {
	int l, r; LL val;
	bool operator < (const node &a) const {
		return val > a.val;
	}
} now;
priority_queue<node> Q;
int t[maxn], a[maxn], f[maxn], n, K, cnt;
LL ans, sum[maxn], tot;

int main() {
	scanf("%d%d", &K, &n);
	rep (i, 1, n) scanf("%d", &t[i]);
	sort(t+1, t+n+1); n--;
	rep (i, 1, n) {
		a[i] = t[i+1] - t[i];
		sum[i] = sum[i-1] + a[i];
		Q.push((node){i, i, a[i]});
	}
	while (K--) {
		int fff = 0;
		while (Q.size()) {
			now = Q.top(); Q.pop(); cnt = 0;
			rep (i, now.l, now.r) cnt += f[i];
			if (cnt == (now.r-now.l) / 2 && !f[now.l-1] && !f[now.r+1]) break;
			if (Q.empty()) fff = 1;
		}
		if (fff) break;
		//printf("%d %d %d\n", now.l, now.r, now.val);
		ans += now.val; tot = 0;
		rep (i, 0, now.r-now.l) {
			f[now.l+i] = (i&1)^1;
			if (f[now.l+i]) tot += a[now.l+i];
		}
		while (3 <= now.l && f[now.l-2]) {
			now.l -= 2; tot += a[now.l];
		}
		while (now.r <= n-2 && f[now.r+2]) {
			now.r += 2; tot += a[now.r];
		}
		if (2 <= now.l && now.r <= n-1)
			Q.push((node){now.l-1, now.r+1, sum[now.r+1] - sum[now.l-2] - tot});
		if (3 <= now.l)
			Q.push((node){now.l-2, now.r, sum[now.r] - sum[now.l-3] - tot});
		if (now.r <= n-2)
			Q.push((node){now.l, now.r+2, sum[now.r+2] - sum[now.l-1] - tot});
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Debug(x)      cerr << #x << "is " << x << '\n';
#define pb            emplace_back
#define mp            make_pair
#define x             first
#define y             second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
const int N = 5002;
const int M = int(5e5) + 2;

int n, k, _a[M];
int f[2 * N][N];
struct TIrene {
    int x, i;
    bool operator<(const TIrene& o)const&{
        return i < o.i;
    }
} a[M];

void Enter()
{
     cin >> k >> n;
     for(int i = 0; i < n; ++i) cin >> _a[i];
     sort(_a, _a + n);
     for(int i = 0; i < n; ++i) {
        if(i) a[i].x = _a[i] - _a[i - 1];
        a[i].i = i;
     }
     sort(a + 1, a + n, [](const TIrene& a, const TIrene& b) {
              return a.x < b.x;
          });
     n = 2 * k;
     sort(a + 1, a + n);
}

void Solve()
{
     int res = (int)1111111111;
     fill_n(&f[0][0], 2 * N * N, 1111111111);
     for(int i = 1; i < n; ++i) {
        if(i - 1) f[i][1] = min(f[i - 1][1], a[i].x);
        else f[i][1] = a[1].x;
        for(int j = 2, l = min(k, i); j <= l; ++j) {
            f[i][j] = min(f[i - 1][j], f[i - 2][j - 1] + a[i].x);
            if(a[i].i > a[i - 1].i + 1) f[i][j] = min(f[i][j], f[i - 1][j - 1] + a[i].x);
        }
     }
     cout << f[n - 1][k];
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(FileName".inp", "r")) {
        freopen(FileName".inp", "r", stdin);
        freopen(FileName".out", "w", stdout);
    }

    /*int nTest; cin >> nTest;
    while(nTest --)*/ Enter(), Solve();

    return 0;
}


#include<bits/stdc++.h>
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Debug(x)      cerr << #x << "is " << x << '\n';
#define pb            emplace_back
#define mp            make_pair
#define x             first
#define y             second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
const int N = 5002;
const int M = int(5e5) + 2;
const ll oo = (ll)1e10;

int n, k, _a[M], cur[3];
vector<ll> f[3];
struct TIrene {
    int x, i;
    bool operator<(const TIrene& o)const&{
        return i < o.i;
    }
} a[M];

void Enter()
{
     cin >> k >> n;
     for(int i = 0; i < n; ++i) cin >> _a[i];
     sort(_a, _a + n);
     for(int i = 0; i < n; ++i) {
        if(i) a[i].x = _a[i] - _a[i - 1];
        a[i].i = i;
     }
     sort(a + 1, a + n, [](const TIrene& a, const TIrene& b) {
              if(a.x != b.x) return a.x < b.x;
              return a.i > b.i;
          });
     int _n = 2 * k, cnt = 2;
     while(_n <= n && a[_n].x == a[_n - 1].x && cnt) ++_n, --cnt;
     n = _n;
     sort(a + 1, a + n);
}

void Solve()
{
     for(int i = 0; i < 3; ++i) {
        f[i].resize(k + 1);
        fill(f[i].begin(), f[i].end(), oo);
        cur[i] = i;
     }
     for(int i = 1; i < n; ++i) {
        if(i - 1) f[cur[2]][1] = min(f[cur[1]][1], (ll)a[i].x);
        else f[cur[2]][1] = a[1].x;
        for(int j = 2, l = min(k, i); j <= l; ++j) {
            if(a[i].i > a[i - 1].i + 1) f[cur[2]][j] = min(f[cur[1]][j], f[cur[1]][j - 1] + a[i].x);
            else f[cur[2]][j] = min(f[cur[1]][j], f[cur[0]][j - 1] + a[i].x);
        }
        int t = cur[0];
        cur[0] = cur[1], cur[1] = cur[2], cur[2] = t;
     }
     cout << f[cur[1]][k];
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(FileName".inp", "r")) {
        freopen(FileName".inp", "r", stdin);
        freopen(FileName".out", "w", stdout);
    }

    /*int nTest; cin >> nTest;
    while(nTest --)*/ Enter(), Solve();

    return 0;
}


#include<bits/stdc++.h>
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Debug(x)      cerr << #x << "is " << x << '\n';
#define pb            emplace_back
#define mp            make_pair
#define x             first
#define y             second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
const int N = 5002;
const int M = int(5e5) + 2;
const ll oo = (ll)1e10;

int n, k, _a[M], cur[3];
vector<ll> f[3];
struct TIrene {
    int x, i;
    bool operator<(const TIrene& o)const&{
        return i < o.i;
    }
} a[M];

void Enter()
{
     cin >> k >> n;
     for(int i = 0; i < n; ++i) cin >> _a[i];
     sort(_a, _a + n);
     for(int i = 0; i < n; ++i) {
        if(i) a[i].x = _a[i] - _a[i - 1];
        a[i].i = i;
     }
     sort(a + 1, a + n, [](const TIrene& a, const TIrene& b) {
              if(a.x != b.x) return a.x < b.x;
              return a.i > b.i;
          });
     int _n = 2 * k, cnt = k;
     while(_n <= n && a[_n].x == a[_n - 1].x && cnt) ++_n, --cnt;
     n = _n;
     sort(a + 1, a + n);
}

void Solve()
{
     for(int i = 0; i < 3; ++i) {
        f[i].resize(k + 1);
        fill(f[i].begin(), f[i].end(), oo);
        cur[i] = i;
     }
     for(int i = 1; i < n; ++i) {
        if(i - 1) f[cur[2]][1] = min(f[cur[1]][1], (ll)a[i].x);
        else f[cur[2]][1] = a[1].x;
        for(int j = 2, l = min(k, i); j <= l; ++j) {
            if(a[i].i > a[i - 1].i + 1) f[cur[2]][j] = min(f[cur[1]][j], f[cur[1]][j - 1] + a[i].x);
            else f[cur[2]][j] = min(f[cur[1]][j], f[cur[0]][j - 1] + a[i].x);
        }
        int t = cur[0];
        cur[0] = cur[1], cur[1] = cur[2], cur[2] = t;
     }
     cout << f[cur[1]][k];
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(FileName".inp", "r")) {
        freopen(FileName".inp", "r", stdin);
        freopen(FileName".out", "w", stdout);
    }

    /*int nTest; cin >> nTest;
    while(nTest --)*/ Enter(), Solve();

    return 0;
}


#include<bits/stdc++.h>
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Debug(x)      cerr << #x << "is " << x << '\n';
#define pb            emplace_back
#define mp            make_pair
#define x             first
#define y             second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
const int N = 5002;
const int M = int(5e5) + 2;
const ll oo = (ll)1e10;

int n, k, _a[M], cur[3];
vector<ll> f[3];
struct TIrene {
    int x, i;
    bool operator<(const TIrene& o)const&{
        return i < o.i;
    }
} a[M];

void Enter()
{
     cin >> k >> n;
     for(int i = 0; i < n; ++i) cin >> _a[i];
     sort(_a, _a + n);
     for(int i = 0; i < n; ++i) {
        if(i) a[i].x = _a[i] - _a[i - 1];
        a[i].i = i;
     }
     sort(a + 1, a + n, [](const TIrene& a, const TIrene& b) {
              return a.x < b.x;
          });
     n = 2 * k;
     sort(a + 1, a + n);
}

void Solve()
{
     for(int i = 0; i < 3; ++i) {
        f[i].resize(k + 1);
        fill(f[i].begin(), f[i].end(), oo);
        cur[i] = i;
     }
     for(int i = 1; i < n; ++i) {
        if(i - 1) f[cur[2]][1] = min(f[cur[1]][1], (ll)a[i].x);
        else f[cur[2]][1] = a[1].x;
        for(int j = 2, l = min(k, i); j <= l; ++j) {
            if(a[i].i > a[i - 1].i + 1) f[cur[2]][j] = min(f[cur[1]][j], f[cur[1]][j - 1] + a[i].x);
            else f[cur[2]][j] = min(f[cur[1]][j], f[cur[0]][j - 1] + a[i].x);
        }
        int t = cur[0];
        cur[0] = cur[1], cur[1] = cur[2], cur[2] = t;
     }
     cout << f[cur[1]][k];
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(FileName".inp", "r")) {
        freopen(FileName".inp", "r", stdin);
        freopen(FileName".out", "w", stdout);
    }

    /*int nTest; cin >> nTest;
    while(nTest --)*/ Enter(), Solve();

    return 0;
}


#include<bits/stdc++.h>
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Debug(x)      cerr << #x << "is " << x << '\n';
#define pb            emplace_back
#define mp            make_pair
#define x             first
#define y             second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
const int N = 5002;
const int M = int(5e5) + 2;

int n, k, _a[M];
int f[2 * N][N];
struct TIrene {
    int x, i;
    bool operator<(const TIrene& o)const&{
        return i < o.i;
    }
} a[M];

void Enter()
{
     cin >> k >> n;
     for(int i = 0; i < n; ++i) cin >> _a[i];
     sort(_a, _a + n);
     for(int i = 0; i < n; ++i) {
        if(i) a[i].x = _a[i] - _a[i - 1];
        a[i].i = i;
     }
     sort(a + 1, a + n, [](const TIrene& a, const TIrene& b) {
              return a.x < b.x;
          });
     n = 2 * k;
     sort(a + 1, a + n);
}

void Solve()
{
     int res = int(2e9);
     fill_n(&f[0][0], 2 * N * N, int(2e9));
     for(int i = 1; i < n; ++i) {
        if(i - 1) f[i][1] = min(f[i - 1][1], a[i].x);
        else f[i][1] = a[1].x;
        for(int j = 2, l = min(k, i); j <= l; ++j) {
            f[i][j] = min(f[i - 1][j], f[i - 2][j - 1] + a[i].x);
            if(a[i].i > a[i - 1].i + 1) f[i][j] = min(f[i][j], f[i - 1][j - 1] + a[i].x);
        }
     }
     cout << f[n - 1][k];
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(FileName".inp", "r")) {
        freopen(FileName".inp", "r", stdin);
        freopen(FileName".out", "w", stdout);
    }

    /*int nTest; cin >> nTest;
    while(nTest --)*/ Enter(), Solve();

    return 0;
}