#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF (1LL<<60)-1
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii query[10000];
bitset<10001> chk;
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		query[i] = iii(x, y, z);
	}
	fup(i, 1, n, 1)
	{
		Vi v;
		fup(j, 0, q - 1, 1)
		{
			int x, y, z;
			tie(x, y, z) = query[j];
			if (x <= i && i <= y)v.push_back(z);
		}
		bitset<10001> bs;
		bs[0] = 1;
		for (int x : v)
			bs |= (bs << x);
		chk |= bs;

	}
	Vi ans;
	fup(i, 1, n, 1)if (chk[i])ans.push_back(i);
	printf("%d\n", ans.size());
	for (int x : ans)printf("%d ", x);
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii query[10000];
bitset<10001> chk;
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		query[i] = iii(x, y, z);
	}
	sort(query, query + q);
	priority_queue<Pi, VPi, greater<Pi> > pq;
	bitset<10001> bs;
	bs[0] = 1;
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		tie(x, y, z) = query[i];
		while (!pq.empty() && pq.top().X < x)
		{
			bs &= (bs >> pq.top().Y);
			pq.pop();
		}
		bs |= (bs << z);
		chk |= bs;
		pq.push(mp(y, z));
	}
	Vi ans;
	fup(i, 1, n, 1)if (chk[i])ans.push_back(i);
	printf("%d\n", ans.size());
	for (int x : ans)printf("%d ", x);
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii query[10000];
bitset<10001> chk;
multiset<int> S;
void go()
{
	bitset<10001> bs;
	bs[0] = 1;
	for (int x : S)bs |= (bs << x);
	chk |= bs;
}
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		query[i] = iii(x, y, z);
	}
	sort(query, query + q);
	priority_queue<Pi, VPi, greater<Pi> > pq;
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		tie(x, y, z) = query[i];
		if (!pq.empty() && pq.top().X < x)
		{
			go();
			while (!pq.empty() && pq.top().X < x)
			{
				S.erase(S.find(pq.top().Y));
				pq.pop();
			}
		}
		S.insert(z);
		pq.push(mp(y, z));
	}
	go();
	Vi ans;
	fup(i, 1, n, 1)if (chk[i])ans.push_back(i);
	printf("%d\n", ans.size());
	for (int x : ans)printf("%d ", x);
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii query[10000];
bitset<10001> chk;
set<int> to[10001],MIN[10001];
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		query[i] = iii(x, y, z);
	}
	sort(query, query + q);
	set<int> pq;
	MIN[0].insert(INF);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		tie(x, y, z) = query[i];
		while (!pq.empty() && *pq.begin() < x)
		{
			int t = *pq.begin();
			for (int next : to[t])
			{
				if (MIN[next].find(t) != MIN[next].end())MIN[next].erase(MIN[next].find(t));
			}
			pq.erase(pq.begin());
		}
		fdn(k, 10000, z, 1)
		{
			for (int x : MIN[k - z])
			{
				int tt = min(x, y);
				MIN[k].insert(tt);
				to[tt].insert(k);
			}
		}
		pq.insert(y);
		fup(i, 1, n, 1)if (!MIN[i].empty())chk[i] = 1;
	}
	Vi ans;
	fup(i, 1, n, 1)if (chk[i])ans.push_back(i);
	printf("%d\n", ans.size());
	for (int x : ans)printf("%d ", x);
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF (1LL<<60)-1
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

iii query[10000];
bitset<10001> chk;
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		query[i] = iii(x, y, z);
	}
	sort(query, query + q);
	bitset<10001> bs;
	bs[0] = 1;
	int l = 1, ii = 0;
	priority_queue<Pi, VPi, greater<Pi> >pq;
	fup(i, 0, q - 1, 1)
	{
		int x, y, z;
		tie(x, y, z) = query[i];
		while (!pq.empty() && pq.top().X < x)
		{
			bs >>= pq.top().Y;
			pq.pop();
		}
		bs |= (bs << z);
		pq.push(mp(y, z));
		chk |= bs;
	}
	Vi ans;
	fup(i, 1, n, 1)if (chk[i])ans.push_back(i);
	printf("%d\n", ans.size());
	for (int x : ans)printf("%d ", x);
}


#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef long long LL;
struct node{
	int a,b;
	node *l,*r;
	vector<int> v;
	node(int _a,int _b):l(NULL),r(NULL){
		a=_a;
		b=_b;
	}
}*root;
void build(node *n){
	if(n->a==n->b)
	return;
	int mid=(n->a+n->b)/2;
	n->l=new node(n->a,mid);
	n->r=new node(mid+1,n->b);
	build(n->l);
	build(n->r);
}
void add(node *n,int l,int r,int k){
	if(n->a>=l&&n->b<=r){
		n->v.pb(k);
		return ;
	}
	if(n->b<l)
	return;
	if(n->a>r)
	return ;
	add(n->l,l,r,k);
	add(n->r,l,r,k);
}
bitset<20000>ans;
void travel(node *n,bitset<20000> res){

	for(auto it:n->v)
	res|=res<<it;
	if(n->a!=n->b){
		travel(n->l,res);
		travel(n->r,res);
	}
	ans|=res;
}
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	root=new node(1,n);
	build(root);
	while(q--){
		int l,r,x;
		scanf("%d %d %d",&l,&r,&x);
		add(root,l,r,x);
	}
	bitset<20000> x;
	x[0]=1;
	travel(root,x);
	vector<int> v;
	for(int i=1;i<=n;i++)
	if(ans[i])
	v.pb(i);
	printf("%d\n",v.size());
	for(auto it:v)
	printf("%d ",it);
}


#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef long long LL;
pair<int,bitset<10005>> b[10005];
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	pair<pii,int> p[20005];
	for(int i=0;i<10005;i++)
	b[i].y[0]=1;
	for(int i=0;i<q;i++){
		int l,r,x;
		scanf("%d %d %d",&l,&r,&x);
		p[i]=mp(mp(l,r+1),x);
	}
	sort(p,p+q);
	int index=0;
	bitset<10005> ans;
	int now=0,nn=0;
	priority_queue<int,vector<int>,greater<int> > pq;
	for(int i=1;i<=n;i++){
		while(index<q&&p[index].x.x==i){
			pq.push(p[index].x.y);
			int j;
			for(j=nn;j>=now;j--){
				if(b[j-1].x>=p[index].x.y)
				b[j]=b[j-1];
				else{
					b[j]=mp(p[index].x.y,((b[j+1].y<<p[index].y)|b[j+1].y));
					break;
				}
			}
			for(j--;j>=now;j--){
				b[j].y|=b[j].y<<p[index].y;
			}
			index++;
			nn++;
		}
		while(!pq.empty()&&pq.top()==i)
		{
			now++;
			pq.pop();
		}
		ans|=b[now].y;
	//	cout<<b[now].y<<endl;
	}
	vector<int> v;
	for(int i=1;i<=n;i++){
		if(ans[i])v.pb(i);
	}
	printf("%d\n",v.size());
	for(auto it:v)
	printf("%d ",it);
	printf("\n");
}


#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef long long LL;
pair<int,bitset<10005>> b[10005];
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	pair<pii,int> p[20005];
	for(int i=0;i<10005;i++)
	b[i].y[0]=1;
	for(int i=0;i<q;i++){
		int l,r,x;
		scanf("%d %d %d",&l,&r,&x);
		p[i]=mp(mp(l,r+1),x);
	}
	sort(p,p+q);
	int index=0;
	bitset<10005> ans;
	int now=0,nn=0;
	priority_queue<int,vector<int>,greater<int> > pq;
	for(int i=1;i<=n;i++){
		while(index<q&&p[index].x.x==i){
			pq.push(p[index].x.y);
			int j;
			for(j=nn;j>=now;j--){
				if(b[j-1].x>=p[index].x.y)
				b[j]=b[j-1];
				else{
					b[j]=mp(p[index].x.y,((b[j+1].y<<p[index].y)|b[j+1].y));
					break;
				}
			}
			for(j--;j>=now;j--){
				b[j].y|=b[j].y<<p[index].y;
			}
			index++;
			nn++;
		}
		while(!pq.empty()&&pq.top()==i)
		{
			now++;
			pq.pop();
		}
		ans|=b[now].y;
	//	cout<<b[now].y<<endl;
	}
	vector<int> v;
	for(int i=1;i<=n;i++){
		if(ans[i])v.pb(i);
	}
	printf("%d\n",v.size());
	for(auto it:v)
	printf("%d ",it);
	printf("\n");
}
close


#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef long long LL;
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	pii p[20005];
	for(int i=0;i<q;i++){
		int l,r,x;
		scanf("%d %d %d",&l,&r,&x);
		p[2*i]=mp(l,x);
		p[2*i+1]=mp(r+1,-x);
	}
	sort(p,p+2*q);
	multiset<int> s;
	int index=0;
	bitset<10005> b;
	for(int i=1;i<=n;i++){
		while(index<2*q&&p[index].x==i){
			if(p[index].y>0)
			s.insert(p[index].y);
			else{
				s.erase(s.find(-p[index].y));
			}
			index++;
		}
		bitset<10005> temp;
		temp[0]=1;
		for(auto it:s)
		temp|=temp<<it;
		b|=temp;
	}
	vector<int> v;
	for(int i=1;i<=n;i++){
		if(b[i])v.pb(i);
	}
	printf("%d\n",v.size());
	for(auto it:v)
	printf("%d ",it);
	printf("\n");
}


#include<bits/stdc++.h>
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define last Last
using namespace std;
typedef long long LL;
pair<int,bitset<15>> b[10005];
int main(){
	int n,q;
	scanf("%d %d",&n,&q);
	pair<pii,int> p[20005];
	for(int i=0;i<10005;i++)
	b[i].y[0]=1;
	for(int i=0;i<q;i++){
		int l,r,x;
		scanf("%d %d %d",&l,&r,&x);
		p[i]=mp(mp(l,r+1),x);
	}
	sort(p,p+q);
	int index=0;
	bitset<15> ans;
	int now=0,nn=0;
	priority_queue<int,vector<int>,greater<int> > pq;
	for(int i=1;i<=n;i++){
		while(index<q&&p[index].x.x==i){
			pq.push(p[index].x.y);
			int j;
			for(j=nn;j>=now;j--){
				if(b[j-1].x>=p[index].x.y)
				b[j]=b[j-1];
				else{
					b[j]=mp(p[index].x.y,((b[j+1].y<<p[index].y)|b[j+1].y));
					break;
				}
			}
			for(j--;j>=now;j--){
				b[j].y|=b[j].y<<p[index].y;
			}
			index++;
			nn++;
		}
		while(!pq.empty()&&pq.top()==i)
		{
			now++;
			pq.pop();
		}
		ans|=b[now].y;
	//	cout<<b[now].y<<endl;
	}
	vector<int> v;
	for(int i=1;i<=n;i++){
		if(ans[i])v.pb(i);
	}
	printf("%d\n",v.size());
	for(auto it:v)
	printf("%d ",it);
	printf("\n");
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <bitset>
#define ll long long
#define MAXN 10000

using namespace std;

vector<pair<int,int>> intervals[MAXN+2];

bitset<MAXN+2> Solve(const map<int,int>& vals, const bitset<MAXN+2>& mask) {
    bitset<MAXN+2> ret = mask;
    ret.set(0);
    int ct = 0;
    for(const pair<int,int>& val : vals) {
        if (ct >= 300)
            break;
        ct++;
        ret |= (ret<<val.first);
    }
    return ret;
}

int main() {
    clock_t starttime=clock();

    int n,Q;
    cin>>n>>Q;

    //n=Q=10000;

    for(int q=1;q<=Q;q++) {
        int L,R,X;
        cin>>L>>R>>X;

        intervals[L].push_back({R,X});
    }

    set<pair<int,int>> endpts;

    bitset<MAXN+2> ans;
    ans.set(0);

    bitset<MAXN+2> prevsolve;
    prevsolve.set(0);

    map<int,int> counts;

    bitset<MAXN+2> mask;

    for(int L=1;L<=n;L++) {
        if(100*(clock()-starttime)>190*CLOCKS_PER_SEC)
            break;

        bitset<MAXN+2> currsolve = prevsolve;

        for(pair<int,int> interval : intervals[L]) {
            endpts.insert(interval);
            counts[interval.second]++;
            currsolve |= (currsolve<<interval.second);
            mask.set(interval.second);
        }

        bool change = false;
        while(!endpts.empty() && endpts.begin()->first <= L-1)
        {
            int val = endpts.begin()->second;
            endpts.erase(endpts.begin());
            counts[val]--;
            if (counts[val]==0) {
                counts.erase(val);
                mask.set(val, 0);
            }

            change = true;

        }
        if (change) {
            currsolve = Solve(counts, mask);
        }
        ans |= currsolve;

        prevsolve = currsolve;
    }

    int ct = 0;
    for(int i=1;i<=n;i++)
        if (ans[i])
            ct++;
    cout << ct << endl;
    for(int i=1;i<=n;i++)
        if (ans[i])
            printf("%d ",i);
    cout << endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <bitset>
#define ll long long
#define MAXN 10000

using namespace std;

vector<pair<int,int>> intervals[MAXN+2];

bitset<MAXN+2> Solve(const map<int,int>& vals) {
    bitset<MAXN+2> ret;
    ret.set(0);
    int ct = 0;
    for(const pair<int,int>& val : vals) {
        if (ct >= 150)
            break;
        ct++;
        ret |= (ret<<val.first);
    }
    return ret;
}

int main() {
    clock_t starttime=clock();

    int n,Q;
    cin>>n>>Q;

    //n=Q=10000;

    for(int q=1;q<=Q;q++) {
        int L,R,X;
        cin>>L>>R>>X;

        intervals[L].push_back({R,X});
    }

    set<pair<int,int>> endpts;

    bitset<MAXN+2> ans;
    ans.set(0);

    bitset<MAXN+2> prevsolve;
    prevsolve.set(0);

    map<int,int> counts;

    for(int L=1;L<=n;L++) {
        if(100*(clock()-starttime)>190*CLOCKS_PER_SEC)
            break;

        bitset<MAXN+2> currsolve = prevsolve;

        for(pair<int,int> interval : intervals[L]) {
            endpts.insert(interval);
            counts[interval.second]++;
            currsolve |= (currsolve<<interval.second);
        }

        bool change = false;
        while(!endpts.empty() && endpts.begin()->first <= L-1)
        {
            int val = endpts.begin()->second;
            endpts.erase(endpts.begin());
            counts[val]--;
            if (counts[val]==0)
                counts.erase(val);

            change = true;

        }
        if (change) {
            currsolve = Solve(counts);
        }
        ans |= currsolve;

        prevsolve = currsolve;
    }

    int ct = 0;
    for(int i=1;i<=n;i++)
        if (ans[i])
            ct++;
    cout << ct << endl;
    for(int i=1;i<=n;i++)
        if (ans[i])
            printf("%d ",i);
    cout << endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <bitset>
#define ll long long
#define MAXN 10000

using namespace std;

vector<pair<int,int>> intervals[MAXN+2];

bitset<MAXN+2> Solve(const map<int,int>& vals) {
    bitset<MAXN+2> ret;
    ret.set(0);
    int ct = 0;
    for(const pair<int,int>& val : vals) {
        if (ct >= 500)
            break;
        ct++;
        ret |= (ret<<val.first);
    }
    return ret;
}

int main() {
    clock_t starttime=clock();

    int n,Q;
    cin>>n>>Q;

    //n=Q=10000;

    for(int q=1;q<=Q;q++) {
        int L,R,X;
        cin>>L>>R>>X;

        intervals[L].push_back({R,X});
    }

    set<pair<int,int>> endpts;

    bitset<MAXN+2> ans;
    ans.set(0);

    bitset<MAXN+2> prevsolve;
    prevsolve.set(0);

    map<int,int> counts;

    for(int L=1;L<=n;L++) {
        if(100*(clock()-starttime)>190*CLOCKS_PER_SEC)
            break;

        bitset<MAXN+2> currsolve = prevsolve;

        for(pair<int,int> interval : intervals[L]) {
            endpts.insert(interval);
            counts[interval.second]++;
            currsolve |= (currsolve<<interval.second);
        }

        bool change = false;
        while(!endpts.empty() && endpts.begin()->first <= L-1)
        {
            int val = endpts.begin()->second;
            endpts.erase(endpts.begin());
            counts[val]--;
            if (counts[val]==0)
                counts.erase(val);

            change = true;

        }
        if (change) {
            currsolve = Solve(counts);
        }
        ans |= currsolve;

        prevsolve = currsolve;
    }

    int ct = 0;
    for(int i=1;i<=n;i++)
        if (ans[i])
            ct++;
    cout << ct << endl;
    for(int i=1;i<=n;i++)
        if (ans[i])
            printf("%d ",i);
    cout << endl;

}


n=int(input())
l=list(map(int,input().split()))
if l.count(max(l))%2==1:
    print("Conan")
else:
    status=False
    for i in l:
        if l.count(i)%2==1:
            status=True
            break
    if status:
        print("Conan")
    else:
        print("Agasa")


n=int(input())
l=list(map(int,input().split()))
dic={}
status=True
i=0
l.sort()
while i<len(l):
    if l.count(l[i])%2==1:
        print("Conan")
        status=False
        break
    else:
        i+=l.count(l[i])

if status:
    print("Agasa")


n=int(input())
l=list(map(int,input().split()))
dic={}
for i in l:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=0
    if i not in l and dic[i]%2==1:
        print("Conan")
    else:
        print("Agasa")


n=int(input())
l=list(map(int,input().split()))
dic={}
status=True
i=0
l.sort()
while i<len(l):
    counter=0
    while True:
        if i<len(l)-1 and l[i+1]==l[i]:
            i+=1
            counter+=1
        else:
            break
    i+=1
    counter+=1
    if counter%2==1:
        status=False
        print("Conan")
        break

if status:
    print("Agasa")


import re
n = int(input())
d = {}
for i in map(int, input().split()):
    if not i in d:
        d[i] = 0
    d[i] += 1
for i in d.values():
    if i % 2 == 1:
        print("Conan")
        quit()
print("Agasa")


import re
n = int(input())
b = input()
a = [*map(int, b.split())]
print("Conan" if len(re.findall(str(max(a)), b)) % 2 == 1 else "Agasa")


def read():
    return list(map(int,input().split()))
n=int(input())
a=read()
b={}
for i in a:
    if i in b:
        b[i]+=1
    else:
        b[i]=1
for i in b:
    if b[i]%2==1:
        print('Conan')
        exit()
print('Agasa')


def read():
    return list(map(int,input().split()))
n=int(input())
a=read()
m=max(a)
q=False
cmax=0
for i in a:
    if i==m:
        cmax+=1
    else:
        q=True
        break
if q:
    print('Conan')
elif cmax%2==1:
    print('Conan')
else:
    print('Agasa')


gets
c=0
h=Hash.new 0
gets.split.each{|e|f[e]=d=f[e]+1;c+=d%2*2-1}
puts c>0 ? :Conan : :Agasa


gets
c=0
h=Hash.new 0
gets.split.each{|e|h[e]=d=h[e]+1;c+=d%2*2-1}
puts c>0 ? :Conan : :Agasa


n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
k = a[-1]
flag = false # Conan wins
while !flag && k
  cnt = 0
  while k == (l = a.pop)
    cnt += 1
  end
  flag = cnt % 2 != 0
  k = l
end
puts flag ? "Conan" : "Agasa"


n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
k = a[-1]
while k && (a.count(k) % 2 == 0)
  a.delete(k)
  k = a[-1]
end
puts a.length == 0 ? "Agasa" : "Conan"


n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
k = a.pop
while k && (a.count(k) % 2 == 1)
  a.delete(k)
  k = a.pop
end
puts a.length == 0 ? "Agasa" : "Conan"


n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
k = a.pop
flag = false # Conan wins
while !flag && k
  cnt = 1
  while k == (l = a.pop)
    cnt += 1
  end
  flag = cnt % 2 != 0
  k = l
end
puts flag ? "Conan" : "Agasa"


n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse

oddcnt = a.group_by{|x| x}.map{|k,v| v.size}.select{|t|t%2==1}.size

puts (oddcnt>0)? 'Conan' : 'Agasa'


n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse

max = a.max
cnt = a.count(max)

puts (cnt%2==1)? 'Conan' : 'Agasa'


import sys as sys
import math as math

mn = map(int,sys.stdin.readline().split())

n = mn[0]

mn = map(int,sys.stdin.readline().split())
maxNot = -10000000
maxN = 0
j = 0
td = 0
for i in range(0,n):
	if mn[i]>maxN:
		maxN = mn[i]
		if (j%2==1):
		    td = 1
		j = 1
	else:
		j=j+1

if n==1:
	print "Conan"
else:
	if (td == 0) and (j%2==0):
		print  "Agasa"
	else:
		print "Conan"


import sys as sys
import math as math

mn = map(int,sys.stdin.readline().split())

n = mn[0]

mn = map(int,sys.stdin.readline().split())

maxN = 0
j = 0
td = 0

mn.sort();

for i in range(0,n):
	if mn[i]>maxN:
		maxN = mn[i]
		if (j%2==1):
		    td = 1
		j = 1
	else:
		j=j+1

if n==1:
	print "Conan"
else:
	if (td == 0) and (j%2==0):
		print  "Agasa"
	else:
		print "Conan"


import sys as sys
import math as math

mn = map(int,sys.stdin.readline().split())

n = mn[0]

mn = map(int,sys.stdin.readline().split())
maxNot = -10000000
maxN = 0
j = 0
for i in range(0,n):
	if mn[i]>maxN:
		maxN = mn[i]
		td = j
		j = 1
	else:
		j=j+1

if (td == 0) and (j%2==0):
	print  "Agasa"
else:
	print "Conan"


import sys as sys
import math as math

mn = map(int,sys.stdin.readline().split())

n = mn[0]

mn = map(int,sys.stdin.readline().split())
maxNot = -10000000
maxN = 0
j = 0
td = 0
for i in range(0,n):
	if mn[i]>maxN:
		maxN = mn[i]
		if (j%2==1):
		    td = 1
		j = 1
	else:
		j=j+1

if (td == 0) and (j%2==0):
	print  "Agasa"
else:
	print "Conan"


n = map(int,raw_input())
arr = map(int,raw_input().split())

arr = sorted(arr,reverse=True)

cnt = arr.count(arr[0])

if cnt % 2 != 0:
    print('Conan')
else:
    i = 0
    flag = True
    while i < n[0]:
        val = arr[i]
        cnt = arr.count(val)
        i = i + cnt
        if cnt % 2 != 0:
            print('Conan')
            flag = False
            break

    if flag:
        print('Agasa')


n = map(int,raw_input())
arr = map(int,raw_input().split())

arr = sorted(arr,reverse=True)

cnt = arr.count(arr[0])

if cnt % 2 == 0:
    print('Agasa')
else:
    print('Conan')


n = map(int,raw_input().split())
arr = map(int,raw_input().split())

arr = sorted(arr,reverse=True)

cnt = arr.count(arr[0])

if cnt % 2 != 0:
    print('Conan')
else:
    i = 0
    flag = True
    while i < n[0]:
        val = arr[i]
        cnt = arr.count(val)
        #print(i,cnt,n)
        i = i + cnt
        if cnt % 2 != 0:
            print('Conan')
            flag = False
            break

    if flag:
        print('Agasa')


n = map(int,raw_input().split())
arr = map(int,raw_input().split())

arr = sorted(arr,reverse=True)

cnt = arr.count(arr[0])

if cnt % 2 != 0:
    print('Conan')
else:
    i = 0
    flag = True
    dic = dict()
    for val in arr:
        if dic.get(val):
            dic[val] = dic[val] + 1
        else:
            dic[val] = 1
    while i < n[0]:
        val = arr[i]
        cnt = dic[val]
        i = i + cnt
        if cnt % 2 != 0:
            print('Conan')
            flag = False
            break

    if flag:
        print('Agasa')


import collections
n=int(raw_input())
lis=map(int,raw_input().split())
lis.sort()
temp=list(set(lis))
ma=max(lis)
cnt=lis.count(ma)
flag=0
b=collections.Counter(lis)
fa=0
for i in b.values():
	if i%2==0:
		continue
	else:
		fa=1
		print "Conan"
		break
if fa==0:
	print "Agasa"


n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

count = 0
maxnum = max(l)
nl = list()

for num in l:
    if num < maxnum:
        continue
    else:
        nl.append(num)

if len(nl) == 0:
    print "Conan"
else:
    nl.remove(maxnum)
    if len(nl)%2 == 0:
        print "Agasa"
    else:
        print "Conan"


import itertools

n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

maxnum = max(l)
l.sort()
groups1 = itertools.groupby(l,lambda x:x)
groups2 = itertools.groupby(l,lambda x:x)
conanflag = False

for key,group in groups1:
    if len(list(group))%2 != 0:
        conanflag = True

for key,group in groups2:
    if maxnum == key:
        if len(list(group)) == 1:
            print "Conan"
            break
        elif len(list(group)) % 2 != 0:
            print "Conan"
            break
        else:
            if conanflag:
                print "Conan"
            else:
                print "Agasa"


import itertools

n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

maxnum = max(l)
nl = list()

if len(l) == 1:
    print "Conan"
else:

    groups = itertools.groupby(l,lambda x:x)
    if len(list(groups)) == 1:
        if len(l)%2 == 0:
            print "Agasa"
        else:
            print "Conan"
    else:
        for num in l:
            if num < maxnum:
                continue
            else:
                nl.append(num)

        nl.remove(maxnum)
        if len(nl) == 0:
            print "Conan"
        else:
            if len(nl)%2 == 0:
                print "Conan"
            else:
                print "Agasa"


import itertools

n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

maxnum = max(l)
nl = list()

if len(l) == 1:
    print "Conan"
else:

    groups = itertools.groupby(l,lambda x:x)
    if len(list(groups)) == 1:
        if len(nl)%2 == 0:
            print "Agasa"
        else:
            print "Conan"
    else:
        for num in l:
            if num < maxnum:
                continue
            else:
                nl.append(num)

        nl.remove(maxnum)
        if len(nl) == 0:
            print "Conan"
        else:
            if len(nl)%2 == 0:
                print "Conan"
            else:
                print "Agasa"


import itertools

n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

maxnum = max(l)
nl = list()

groups = itertools.groupby(l,lambda x:x)
if len(list(groups)) == 1:
    if len(nl)%2 == 0:
        print "Agasa"
    else:
        print "Conan"
else:
    for num in l:
        if num < maxnum:
            continue
        else:
            nl.append(num)

    nl.remove(maxnum)
    if len(nl) == 0:
        print "Conan"
    else:
        if len(nl)%2 == 0:
            print "Conan"
        else:
            print "Agasa"


n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

count = 0
maxnum = max(l)
nl = list()
for num in l:
    if num < maxnum:
        continue
    else:
        nl.append(num)
if len(nl) == 0:
    print "Conan"
else:
    if len(nl)%2 == 0:
        print "Agasa"
    else:
        print "Conan"


n = int(raw_input())
l = raw_input().split()
l = [int(x) for x in l]

count = 0
maxnum = max(l)
nl = list()

for num in l:
    if num < maxnum:
        continue
    else:
        nl.append(num)
nl.remove(maxnum)
if len(nl) == 0:
    print "Conan"
else:
    if len(nl)%2 == 0:
        print "Agasa"
    else:
        print "Conan"


input()
c={}
for x in map(int,raw_input().split()):
    c[x]=c.get(x,0)^1
for x in sorted(c)[::-1]:
    if c[x]:
        print 'Conan'
        break
else:
    print 'Agasa'


def main():
    n=input()
    l=map(long,raw_input().split())
    c=0
    p=[0]*(max(l))
    for i in l:
        p[i-1]+=1
    for i in p:
        if i%2!=0:
            c=1
            break
    if c==0:
        print "Agasa"
    else:
        print "Conan"
main()


def main():
    n=input()
    l=map(long,raw_input().split())
    l.sort()
    if n==1:
        print "Conan"
    else:
        if len(set(l))==1:
            if n%2==0:
                print "Agasa"
            else:
                print "Conan"
        elif len(set(l))%2==0:
            print "Agasa"
        else:
            print "Conan"
main()


#!/usr/bin/env python
# coding: utf8

import sys
from collections import defaultdict

def main():
    #sys.stdin = open('A.in', 'r')
    #sys.stdout = open('A.out', 'w')
    n = int(raw_input())
    a = map(int, raw_input().split())
    d = defaultdict(int)
    for x in a:
        d[x] += 1
    print 'Conan' if any(x % 2 for x in d.values()) else 'Agasa'

if __name__ == "__main__":
    main()


from sys import stdin
n = int(stdin.readline())
di = {}
a = map(int,stdin.readline().split())
ans = 'Agasa'
for i in a:
 di[i] = di.get(i,0) + 1
for i in di:
 if di[i]%2:
  ans = 'Conan'
print ans


n=input()
#a
a=list(map(int,raw_input().split()))
c=[0 for i in range(100004)]
for i in a:
    c[i]+=1
    c[i]%=2
if 1 in c:
    print "Conan"
else:
    print "Agasa"


n=input()
a=list(map(int,raw_input().split()))
m=max(a)
c=a.count(m)
if c%2==1:
    print "Conan"
else:
    print "Agasa"


n=input()
a=list(map(int,raw_input().split()))
c=[0 for i in range(100004)]
for i in a:
    c[i]+=1
    c[i]%=2
if 1 in c:
    print "Conan"
else:
    print "Agasa"


n=input()
a=list(map(int,raw_input().split()))
m=max(a)
c=a.count(m)
if c%2==0:
    print "Conan"
else:
    print "Agasa"


from collections import defaultdict
n = int(raw_input())
a = map(int, raw_input().split())
d = defaultdict(int)
for x in a:
    d[x] += 1
print 'Conan' if any(x % 2 for x in d.values()) else 'Agasa'


n = input()
l = map(int, raw_input().split())
l.sort()
flag, tmp = 0, 1
for i in range(n-2, -1, -1):
	if l[i] == l[i+1]:
		tmp += 1
	else:
		if tmp%2 == 1:
			flag = 1
			ans = "Conan"
		else:
			tmp = 1
if flag == 1:
	print ans
else:
	if tmp%2 == 1:
		print "Conan"
	else:
		print "Agasa"


n = input()
l = map(int, raw_input().split())
flag, tmp = 0, 1
for i in range(n-2, -1, -1):
	if l[i] == l[i+1]:
		tmp += 1
	else:
		if tmp%2 == 1:
			flag = 1
			ans = "Conan"
		else:
			tmp = 1
if flag == 1:
	print ans
else:
	if tmp%2 == 1:
		print "Conan"
	else:
		print "Agasa"


n = input()
l = map(int, raw_input().split())
l.sort()
tmp = 0
ans = "Agasa"
for i in range(n-2, -1, -1):
	if l[i]==l[i+1]:tmp += 1
	else:
		if tmp%2==0:ans = "Conan"
		else:tmp=0
print ans


n = input()
l = map(int, raw_input().split())
l.sort()
tmp = 0
ans = "Agasa"
for i in range(n-2, -1, -1):
	if l[i]==l[i+1]:tmp += 1
	else:
		if tmp%2==0:ans = "Conan"
		else:tmp=0
print "Agasa" if tmp%2 == 0 else "Conan"


n = input()
l = map(int, raw_input().split())
i = 0
while len(l) > 0:
	elem = l.pop()
	while len(l) > 0 and elem > l[-1]:
		l.pop()
	i += 1
if i%2 == 1:print "Conan"
else:print "Agasa"


n = input()
l = map(int, raw_input().split())
l.sort()
tmp = 0
flag = 0
ans = "Agasa"
for i in range(n-2, -1, -1):
	if l[i]==l[i+1]:tmp += 1
	else:
		if tmp%2==0:ans = "Conan"
		else:tmp=0
print ans if flag == 1 else "Conan" if tmp%2 == 0 else "Agasa"


n = input()
l = map(int, raw_input().split())
l.sort()
tmp = 0
ans = "Agasa"
for i in range(n-2, -1, -1):
	if l[i]==l[i+1]:tmp += 1
	else:
		if tmp%2==0:ans = "Conan"
		else:tmp=1
print ans


def is_odd(dic, keys):
	for x in keys:
		if dic[x] % 2 == 1:
			return 1
	return 0

N = input()
ar = map(int, raw_input().split(" "))
dic = {}
keys = []

for x in ar:
	if x in dic:
		dic[x] +=1
	else:
		dic[x] = 1
		keys.append(x)

keys.sort()

keys.reverse()

if is_odd(dic, keys) == 1:
	print "Conan"
else:
	print "Agasa"


n=int(raw_input())
a=map(int,raw_input().split())
b={}
for i in a:
    b[i]=0
for i in a:
    b[i]+=1
for i in b:
    if b[i]%2==1:
        print "Conan"
        break
else:
    print "Agasa"


import math
import operator
import collections

def main():
    n = int(raw_input())
    cards = map(int, raw_input().split())

    d = dict()
    for c in cards:
        if c in d:
            d[c] += 1
        else:
            d[c] = 1

    od = collections.OrderedDict(sorted(d.items()))

    for k, v in od.iteritems():
        if od[k] % 2 == 1:
            return 'Conan'
    return 'Agasa'

if __name__ == '__main__':
    print(main())


n=int(raw_input())
l=map(int,raw_input().strip().split())
l.sort()
l2=[]
a=l[-1]
count=1
for i in range(n-2,-1,-1):
    if l[i]==a:
        count=count+1
    else:
        l2.append(count)
        count=1
        a=l[i]
l2.append(count)
h=4
for t in l2:
    if t%2==0:
        pass
    else:
        h=3
        break
if h==3:
    print "Conan"
else:
    print "Agasa"


n=int(raw_input())
l=map(int,raw_input().strip().split())
l2=[]
a=l[-1]
count=1
for i in range(n-2,-1,-1):
    if l[i]==a:
        count=count+1
    else:
        l2.append(count)
        count=1
        a=l[i]
l2.append(count)
h=4
for t in l2:
    if t%2==0:
        pass
    else:
        h=3
        break
if h==3:
    print "Conan"
else:
    print "Agasa"


from collections import defaultdict
n = input()
d = defaultdict(int)
ar = map(int, raw_input().split())
for a in ar:
	d[a] += 1

w = False

for k, v in d.iteritems():
	if v%2:
		w = True

print 'Conan' if w else 'Agasa'


n = input()
d = [0]*(100002)
ar = map(int, raw_input().split())
for a in ar:
	d[a] += 1

w = False

for i in xrange(100000, 0, -1):
	if d[a]%2:
		w = True

print 'Conan' if w else 'Agasa'


n = input()
ar = map(int, raw_input().split())
mx = max(ar)
ret = ar.count(mx)
if ret&1:
	print 'Conan'
else:
	print 'Agasa'


n = input()
d = [0]*(100002)
ar = map(int, raw_input().split())
for a in ar:
	d[a] += 1

w = False

for i in xrange(100000, 0, -1):
	if d[i]%2:
		w = True

print 'Conan' if w else 'Agasa'


N = int(raw_input())
nums = list(map(int,raw_input().split()))
num = nums.count(max(nums))
if num%2:
  print "Conan"
else:
  arr = [0 for x in range(100001)]
  for i in nums:
    arr[i] += 1
  nums = sorted(nums)
  nums = set(nums)
  found = False
  for i in range(len(nums)-1,-1,-1):
    if arr[nums[i]]%2:
      found = True
      break
  if found:
    print "Conan"
  else:
    print "Agasa"


N = int(raw_input())
nums = list(map(int,raw_input().split()))
num = nums.count(max(nums))
if num%2:
  print "Conan"
else:
  arr = [0 for x in range(100001)]
  for i in nums:
    arr[i] += 1
  nums = sorted(nums)
  found = False
  for i in range(len(nums)-1,-1,-1):
    if arr[nums[i]]%2:
      found = True
      break
  if found:
    print "Conan"
  else:
    print "Agasa"


N = int(raw_input())
nums = list(map(int,raw_input().split()))
num = nums.count(max(nums))
if num%2:
  print "Conan"
else:
  arr = [0 for x in range(100001)]
  for i in nums:
    arr[i] += 1
  nums = sorted(nums)
  nums = set(nums)
  found = False
  for i in range(len(nums)-1,-1,-1):
    if arr[i]%2:
      found = True
      break
  if found:
    print "Conan"
  else:
    print "Agasa"


import sys

#read in information from std input
ls = []
answer = 'Agasa'

####################################################
# When submitting for real, comment the next line,
# uncomment when developing.
#sys.stdin = open("../input/input1.txt")
####################################################

els = sys.stdin.readline().strip()

for i in sys.stdin.readline().split(' '):
    num = int(i.strip())
    ls.append(num)

ls.sort(reverse=True)
counter = 0
while len(ls) > 1:
    while ls[0] == ls[1]:
        counter +=1
        del ls[0]
        if len(ls) == 1:
            break
    del ls[0]

if counter%2 == 0:
    answer = 'Conan'

print answer


import sys

#read in information from std input
ls = []
answer = 'Agasa'

####################################################
# When submitting for real, comment the next line,
# uncomment when developing.
#sys.stdin = open("../input/input1.txt")
####################################################

els = sys.stdin.readline()
groups = []

for i in sys.stdin.readline().split(' '):
    num = int(i.strip())
    ls.append(num)

if len(ls)%2:
    print 'Conan',
    exit()
ls.sort()
counter = 1
prev = ls[0]
for x in xrange(1,len(ls)):
    if prev == ls[x]:
        counter += 1
    else:
        groups.append(counter)
        counter = 1
    prev = ls[x]
groups.append(counter)
for e in groups:
    if e%2:
        answer = 'Conan'
print answer


import sys

#read in information from std input
ls = []
answer = 'Agasa'

####################################################
# When submitting for real, comment the next line,
# uncomment when developing.
#sys.stdin = open("../input/input1.txt")
####################################################

els = sys.stdin.readline().strip()

for i in sys.stdin.readline().split(' '):
    num = int(i.strip())
    ls.append(num)

ls.sort(reverse=True)
counter = 0
while ls[0] == ls[1]:
    counter +=1
    del ls[0]
    if len(ls) == 1:
        break

if counter%2 == 0:
    answer = 'Conan'

print answer


import sys

#read in information from std input
ls = []
answer = 'Agasa'

####################################################
# When submitting for real, comment the next line,
# uncomment when developing.
#sys.stdin = open("../input/input1.txt")
####################################################

els = sys.stdin.readline().strip()

for i in sys.stdin.readline().split(' '):
    num = int(i.strip())
    ls.append(num)

ls.sort(reverse=True)
counter = 0
if len(ls) == 1:
    print 'Conan',
    exit()
while ls[0] == ls[1]:
    counter +=1
    del ls[0]
    if len(ls) == 1:
        break

if counter%2 == 0:
    answer = 'Conan'

print answer


n=int(input())
arr=map(int, raw_input().split())
arr.sort(reverse=True)
x = 0
for i in range(1,n):
    if arr[i] == arr[i-1]:
        x = (x+1) % 2
    elif x == 0:
        print "Conan"
        break
    else: x = 0
else: print "Conan" if x == 0 else "Agasa"


import sys

n=int(input())
arr=map(int, raw_input().split())
arr.sort(reverse=True)
x = 0
for i in range(1,n):
    if arr[i] == arr[i-1]:
        x = (x+1) % 2
    elif x == 0:
        print "Conan"
        sys.exit()
    else: x = 0
print "Conan" if x == 0 else "Agasa"


n=int(raw_input())
a=[int(k) for k in raw_input().split(" ")]
d={}

for k in a:
    if k not in d:
        d[k]=0
    d[k]+=1

willConanwin=False
for k in d.values():
    if k%2==1:
        willConanwin=True
        break

if willConanwin:
    print "Conan"
else:
    print "Agasa"


from array import *

def sol(arr):

    largest = 0
    num_largest = 0
    lowest = 1000000
    for x in arr:
        if x > largest:
            largest = x
            num_largest = 1
        elif x == largest:
            num_largest += 1
        if x < lowest:
            lowest = x

    if largest != lowest:
        return 'Conan'
    elif num_largest % 2 == 0:
        return 'Agasa'
    else:
        return 'Conan'

# input
n = input()
arr = [int(x) for x in raw_input().split()]
print sol(arr)


from array import *

def sol(arr):

    my_list = list()
    ii = 0
    while True:
        if ii > 100005:
            break
        my_list.append(0)
        ii += 1

    for x in arr:
        my_list[x] += 1

    for x in my_list:
        if x % 2 == 1:
            return 'Conan'
    return 'Agasa'

# input
n = input()
arr = [int(x) for x in raw_input().split()]
print sol(arr)


def checaSeEImpar(dicionario, chaves):
	for i in chaves:
		if dicionario[i] % 2 == 1:
			return True
	return False

N = input()
a = map(int, raw_input().split(" "))

dicionario = {}
chaves = []
for i in a:
	if i in dicionario:
		dicionario[i] +=1
	else:
		dicionario[i] = 1
		chaves.append(i)

chaves.sort()
chaves.reverse()
if checaSeEImpar(dicionario, chaves) == True:
	print "Conan"
else:
	print "Agasa"


def checaSeEImpar(dicionario, chaves):
	for i in chaves:
		if dicionario[i] % 2 == 1:
			return True
	return False
N = input()
a = map(int, raw_input().split(" "))

dicionario = {}
chaves = []
for i in a:
	if i in dicionario:
		dicionario[i] +=1
	else:
		dicionario[i] = 1
		chaves.append(i)

chaves.sort()
chaves.reverse()
if checaSeEImpar(dicionario, chaves) == True:
	print "Conan"
else:
	print "Agasa"


n = input()
a = sorted(map(int, raw_input().split()))
if n & 1:
	print 'Conan'
	exit(0)
for i in range(0, n, 2):
	if a[i] != a[i + 1]:
		print 'Conan'
		break
else:
	print 'Agasa'


n = input()
a = map(int, raw_input().split())
if n & 1:
	print 'Conan'
	exit(0)
for i in range(0, n, 2):
	if a[i] != a[i + 1]:
		print 'Conan'
		break
else:
	print 'Agasa'


def getWin(d):
	for i in d:
		if d[i]%2:
			return "Conan"
	return "Agasa"
n = int(raw_input())
a = map(int,raw_input().split())
d = {}
for i in a:
	d[i] = d.get(i,0)+1
print getWin(d)


def getWin(d,x):
	for i in d:
		if i==x:
			if d[i]&1:
				return "Conan"
			else:
				return "Agasa"
n = int(raw_input())
a = map(int,raw_input().split())
d = {}
for i in a:
	d[i] = d.get(i,0)+1
x = max(a)
print getWin(d,x)


def getWin(d,x):
	for i in d:
		if d[i]%2:
			return "Conan"
	return "Agasa"
n = int(raw_input())
a = map(int,raw_input().split())
d = {}
for i in a:
	d[i] = d.get(i,0)+1
print getWin(d,x)


n=int(raw_input())
A=map(int, raw_input().split())

def game(n,A):
    if n==1:
        return "Conan"
    A.sort(reverse=True)
    ct=1
    x=A[0]
    for i in range(1,n):
        if A[i]==x:
            ct+=1
        else:
            if ct%2==1:
                return "Conan"
            else:
                x=A[i]
                ct=1
    if ct%2==1:
        return "Conan"
    return "Agasa"
print game(n,A)


from collections import defaultdict
def init(): return int(0)

n = input()
A = map(int, raw_input().split())
freq = defaultdict(init)
for a in A:
	freq[a] += 1
breaked = False
for k in freq.keys():
	if freq[k]%2 == 1:
		print "Conan"
		breaked = True
		break
if not breaked:
	print "Agasa"


n = input()
A= map(int, raw_input().split())
A.sort()
A = A[::-1]
prev = A[0]
conan = True
for i in xrange(1,n):
	if A[i] < A[i-1]:
		continue
	conan = not conan
if conan:
	print "Conan"
else:
	print "Agasa"


n = input()
s = [0]*10001
a = map(int,raw_input().split())
for _ in xrange(n):
	s[a[_]]=(s[a[_]]+1)%2
if sum(s)%2==1:
	print 'Conan'
else:
	print 'Agasa'


from collections import Counter
n = input()
a = Counter(map(int,raw_input().split()))
for i in sorted(a.keys(),reverse=True):
	if a[i]%2==1:
		print 'Conan'
		exit(0)
print 'Agasa'


l = [0]*(10**5+5)
n = int(raw_input())
c = map(int, raw_input().split())
for i in range(len(c)):
    l[c[i]] += 1
w = filter(lambda x: l[x] % 2 == 1, range(len(l)))
if w==[]:
    print "Agasa"
else:
    print "Conan"


from collections import Counter
n=int(raw_input())
a=list(map(int,raw_input().split()))
d=Counter(a)
for i in d:
	if d[i]&1:
		print "Conan"
		exit()
print "Agasa"


from collections import Counter
n=int(raw_input())
a=list(map(int,raw_input().split()))
print ["Agasa", "Conan"][(Counter(a)[max(a)])&1]


def f(nums, n):
    while n > 0:
        lo = nums[0]
        hi = nums[n - 1]

        if lo == hi:
            if n % 2 != 0:
                return "Conan"
            else:
                return "Agasa"

        i = n - 1
        while nums[i] == hi:
            i -= 1
        i += 1

        num_hi = n - i

        if num_hi % 2 != 0:
            return "Conan"
        else:
            n = i
    return "Agasa"

n = input()
l = raw_input()
l = l.split(' ')
m = []
for i in l: m.append(int(i))
m.sort()
print f(m, len(m))


def f(nums, n):
    if n <= 0: return "Agasa"

    lo = nums[0]
    hi = nums[n - 1]

    if lo == hi:
        if n % 2 != 0:
            return "Conan"
        else:
            return "Agasa"

    i = n - 1
    while nums[i] == hi:
        i -= 1
    i += 1

    num_hi = n - i

    if num_hi % 2 != 0:
        return "Conan"
    else:
        return f(nums, i)

n = input()
l = raw_input()
l = l.split(' ')
m = []
for i in l: m.append(int(i))
m.sort()
print f(m, len(m))


'''input
4
1 1 1 2 2

'''
from bisect import bisect_left as bl
from itertools import combinations as c
from collections import defaultdict as df
from math import factorial as F

n=input()
l=[int(x) for x in raw_input().split()]
l=sorted(l)
temp=set(l)
C=[]
for i in temp:
	C.append(l.count(i))
win=False
for i in range(len(C)-1,-1,-1):
	if C[i]&1:
		win=True
		break
if win:
	print "Conan"
else:
	print "Agasa"


'''input
11
0 0 1 1 1 2 2 2 3 3

'''
from bisect import bisect_left as bl
from itertools import combinations as c
from collections import defaultdict as df
from math import factorial as F

n=input()
l=[int(x) for x in raw_input().split()]
l=sorted(l)
temp=sorted(list(set(l)))

C=[]
for i in temp:
	C.append(l.count(i))
win=False
for i in range(len(C)-1,-1,-1):
	if C[i]&1:
		win=True
		break
if win:
	print "Conan"
else:
	print "Agasa"


'''input
11
0 0 1 1 1 2 2 2 3 3

'''
from bisect import bisect_left as bl
from itertools import combinations as c
from collections import defaultdict as df
from math import factorial as F

n=input()
CC=df(int)
l=[int(x) for x in raw_input().split()]

l=sorted(l)
temp=sorted(list(set(l)))

C=[]
for i in l:
	CC[i]+=1
for i in temp:
	C.append(CC[i])
win=False
for i in range(len(C)-1,-1,-1):
	if C[i]&1:
		win=True
		break
if win:
	print "Conan"
else:
	print "Agasa"


n = int(raw_input())
A = [int(x) for x in raw_input().split()]
A = sorted(A, reverse=True)
won = 0
i = 0
while not won and i + 1< n:
    c = i
    while A[i] == A[i + 1]:
        i = i+1
    if (i + 1 - c )%2 == 1:
        won = 1
        print "Conan"
        break
    else:
        print "Agasa"
        break


from collections import Counter

n = int(raw_input())
A = [int(x) for x in raw_input().split()]
fr = Counter(A)
# fr = sorted(A, reverse=True)
fr = sorted(fr.items(), key=lambda x: x[0], reverse=True)
won = 0
prev = 0
for c in fr:
    if c[1] % 2 == 1:
        won = 1
        print "Conan"
        break
if won == 0:
    print "Agasa"


__author__ = 'tanunia'

import sys

n = int(sys.stdin.readline())
a = sorted([int(x) for x in sys.stdin.readline().split(" ")])

if n == 1:
    print "Conan"
    exit(0)

if a[-1] != a[-2]:
    print "Conan"
    print exit(0)

mp = {}
for it in a:
    if it in mp:
        mp[it] += 1
    else:
        mp[it] = 1

k = sorted(mp.keys())

for it in k[::-1]:
    if mp[it] % 2 != 0:
        print "Conan"
        exit(0)

print "Agasa"


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
int main()
{
	ll n;
	cin >> n;
	vector<pair<string, int>>s(2 * n);
	for(int i = 0; i < 2 * n; i++)
	{
		cin >> s[i].first;
		s[i].second = 0;
	}
	int pos = 0;
	for(int i = 0; i < n; i++)
	{
		for(int j = n; j < 2 * n; j++)
		{
			if(s[i] == s[j] && i != j)
			{
				s[i].second = 1;
				s[j].second = 1;
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < 2 * n; i++)
		if(!s[i].second)
			ans++;
	cout << ans / 2;
	return 0;
}


#pragma comment(linker, "/STACK:36777216")
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>

typedef long long ll;

using namespace std;
inline ll MAX(ll a, ll b) { return (a > b) ? (a) : (b); }
inline ll MIN(ll a, ll b) { return (a < b) ? (a) : (b); }

#define rep(i,a,b) for(i=a; i<=b; i++)
#define brep(i,b,a) for(i=b; i>=a; i--)
#define sd second
#define ft first
//#define mp make_pair

int main()
{
	int const sz = 5e5 + 10;
	ll  i, j, n, r, x, y,m[2],k,q,z;

	map<string,ll> a;
	map<string, ll> b;
	string s;
	cin >> n;

	rep(i, 1, n) { cin >> s; a[s]++; }

	rep(i, 1, n) { cin >> s; b[s]++; }

	std::map<string,ll>::iterator it,it2;

	ll cnt = 0;

	while (n)
	{
		for (it = a.begin(); it != a.end(); it++)
		{
			bool fl = 0;
			for (it2 = b.begin(); it2 != b.end(); it2++)
			{
				if (it->first == it2->first && it->second > 0 && it2->second > 0)
				{
					fl = 1;
					it->second--;
					it2->second--;
					n--;
					break;
				}
			}

			if (fl == 0)
			{
				for (it2 = b.begin(); it2 != b.end(); it2++)
				{
					if (it->first.length() == it2->first.length() && it->second > 0 && it2->second > 0)
					{
						fl = 1;
						it->second--;
						it2->second--;
						cnt++;
						n--;
						break;
					}
				}
			}
		}
	}

	cout << cnt;

	return 0;
}


#pragma comment(linker, "/STACK:36777216")
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>

typedef long long ll;

using namespace std;
inline ll MAX(ll a, ll b) { return (a > b) ? (a) : (b); }
inline ll MIN(ll a, ll b) { return (a < b) ? (a) : (b); }

#define rep(i,a,b) for(i=a; i<=b; i++)
#define brep(i,b,a) for(i=b; i>=a; i--)
#define sd second
#define ft first
//#define mp make_pair

int dif(string a, string b)
{
	int i,cnt=0;

	rep(i, 0, a.length()-1)
	{
		if (a[i] != b[i]) cnt++;
	}
	return cnt;
}

int main()
{
	int const sz = 5e5 + 10;
	ll  i, j, n, r, x, y,m[2],k,q,z;

	map<string,ll> a;
	map<string, ll> b;
	string s,s1,s2;
	cin >> n;

	rep(i, 1, n) { cin >> s; a[s]++; }

	rep(i, 1, n) { cin >> s; b[s]++; }

	std::map<string,ll>::iterator it,it2;

	ll cnt = 0;

	while (1)
	{
		bool fl = 0;

		for (it = a.begin(); it != a.end(); it++)
		{
			bool fl = 0;
			for (it2 = b.begin(); it2 != b.end(); it2++)
			{
				if (it->first == it2->first && it->second > 0 && it2->second > 0)
				{
					fl = 1;
					it->second--;
					it2->second--;
					n--;
				}
			}
		}

		if (fl == 0) break;
	}

	while (n)
	{
		bool fl = 0;

			ll mm = 1e7;
			for (it = a.begin(); it != a.end(); it++)
			{
				for (it2 = b.begin(); it2 != b.end(); it2++)
				{
					if (it->first.length() == it2->first.length() && it->second > 0 && it2->second > 0)
					{
						if (mm > dif(it->first, it2->first))
						{
							mm = dif(it->first, it2->first);
							s1 = it->first;
							s2 = it2->first;
						}

					}
				}
			}

			a[s1]--;
			b[s2]--;
			cnt += mm;
			n--;

	}

	cout << cnt;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

void f(vector<string>& buf, const int& n) {
    for (int i = 0; i < n; i++) {
        cin >> buf[i];
    }
}

int main()
{
    int n = 0;
    cin >> n;
    vector<string> buf1(n, "");
    vector<string> buf2(n, "");
    f(buf1, n);
    f(buf2, n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (buf1[i] == buf2[j]) {
                buf1.erase(buf1.begin() + i);
                buf2.erase(buf2.begin() + j);
                i--;
                j--;
                n--;
                break;
            }
        }
    }
    cout << n;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define MAX int(1e5+5)
vector<string> a[5];
vector<string> b[5];
void main()
{
	for (int i = 0; i <= 4; i++)
	{
		a[i].clear();
		b[i].clear();
	}

	int n;
	cin >> n;
	string c;
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		a[c.length()].push_back(c);
	}
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		b[c.length()].push_back(c);
	}
	long long ans = 0;
	for (int i = 1; i <= 5; i++)
	{
		int size = b[i].size();
		if (!size) continue;
		else
		{
			sort(a[i].begin(), a[i].end());
			sort(b[i].begin(), b[i].end());
			for (int j = 0; j < size ; j++)
			{
				int dif = 0;
				for (int k = 0; k < i; k++)
				{
					if (a[i][j][k] != b[i][j][k]) dif++;
				}
				ans += dif;
			}

		}
	}
	cout << ans;

}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define MAX int(1e5+5)

vector<string> a[5];
vector<string> b[5];
void main()
{
	int n;
	cin >> n;
	string c;
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		a[c.length()].push_back(c);
	}
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		b[c.length()].push_back(c);
	}
	int ans = 0;
	for (int i = 1; i <= 5; i++)
	{

		int size = b[i].size();

		if (!size) continue;
		else
		{
			sort(a, a + size);
			sort(b, b + size);
			for (int j = 0; j < size ; j++)
			{
				int dif = 0;
				for (int k = 0; k < i; k++)
				{
					if (a[i][j][k] != b[i][j][k]) dif++;
				}
				ans += dif;
			}

		}
	}
	cout << ans;

}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
const int N = 105;
string a[N], b[N];
map<string, int>A, B;
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++) {
		A[a[i]]++;
		B[b[i]]++;
	}
	map<string, int>::iterator it;
	int ans = n;
	for (it = A.begin(); it != A.end(); it++)
		ans -= min(it->second, B[it->first]);
	cout << ans << endl;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define MAX int(1e5+5)
vector<string> a[5];
vector<string> b[5];
void main()
{
	int n;
	cin >> n;
	string c;
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		a[c.length()].push_back(c);
	}
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		b[c.length()].push_back(c);
	}
	int ans = 0;
	for (int i = 1; i <= 5; i++)
	{

		int size = b[i].size();
		if (!size) continue;
		else
		{
			sort(a[i].begin(), a[i].end());
			sort(b[i].begin(), b[i].end());

			for (int j = 0; j < size ; j++)
			{
				int dif = 0;
				for (int k = 0; k < i; k++)
				{
					if (a[i][j][k] != b[i][j][k]) dif++;
				}
				ans += dif;
			}

		}
	}
	cout << ans;

}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define MAX int(1e5+5)
vector<string> a[5];
vector<string> b[5];
void main()
{
	for (int i = 0; i <= 4; i++)
	{
		a[i].clear();
		b[i].clear();
	}

	int n;
	cin >> n;
	string c;
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		a[c.length()].push_back(c);
	}
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		b[c.length()].push_back(c);
	}
	long long ans = 0;
	for (int i = 1; i <= 5; i++)
	{
		int size = b[i].size();
		if (!size) continue;
		else
		{
			sort(a[i].begin(), a[i].end());
			sort(b[i].begin(), b[i].end());
			for (int j = 0; j < size ; j++)
			{

					if (a[i][j][i-1] != b[i][j][i-1])
					{
						ans++;
						break;
					}

			}

		}
	}
	cout << ans;

}


n = int(input())
temp1 = []
temp2 = []
for i in range(n):
    temp1.append(input())
for i in range(n):
    temp2.append(input())
a = [[]] * 5
b = [[]] * 5
#print(a)
cnt = 0
for i in temp1:
    k = len(i) - 1
    a[k] = a[k] + [i]
for i in temp2:
    k = len(i) - 1
    b[k] = b[k] + [i]
for i in range(5):
    m1 = a[i].count('M')
    m2 = b[i].count('M')
    s1 = a[i].count('X'*i+'S')
    s2 = b[i].count('X'*i+'S')
    cnt += abs(m1-m2) + abs(s1+m1-m2-s2)
print(cnt)


n = int(input())
temp1 = []
temp2 = []
for i in range(n):
    temp1.append(input())
for i in range(n):
    temp2.append(input())
a = [[]] * 5
b = [[]] * 5
#print(a)
cnt = 0
for i in temp1:
    k = len(i) - 1
    a[k] = a[k] + [i]
for i in temp2:
    k = len(i) - 1
    b[k] = b[k] + [i]
for i in range(5):
    m1 = a[i].count('M')
    m2 = b[i].count('M')
    s1 = a[i].count('X'*i+'S')
    s2 = b[i].count('X'*i+'S')
    l1 = len(a) - m1 - s1
    l2 = len(b) - m2 - s2
    cnt += int((abs(m1-m2)+abs(s1-s2)+abs(l1-l2))/2)
print(cnt)


n = int(input())
temp1 = []
temp2 = []
for i in range(n):
    temp1.append(input())
for i in range(n):
    temp2.append(input())
a = [[]] * 5
b = [[]] * 5
#print(a)
cnt = 0
for i in temp1:
    k = len(i) - 1
    a[k] = a[k] + [i]
for i in temp2:
    k = len(i) - 1
    b[k] = b[k] + [i]
for i in range(5):
    m1 = a[i].count('M')
    m2 = b[i].count('M')
    s1 = a[i].count('X'*i+'S')
    s2 = b[i].count('X'*i+'S')
    l1 = len(a) - m1 - s1
    l2 = len(b) - m2 - s2
    cnt += min(abs(m1-m2) + abs(s1+m1-m2-s2), abs(m1-m2) + abs(l1+m1-m2-l2))
print(cnt)


n = int(input())

a = list()
b = list()
for i in range(n):
    a.append(input())
while True:
    try:
        b.append(input())
    except:
        break
res = 0
for elem in a:
    if elem not in b:
        res += 1
    else:
        del (b[b.index(elem)])
print(res)


n = int(input())

a = list()
b = list()
for i in range(n):
    a.append(input())
while True:
    try:
        b.append(input())
    except:
        break
res = 0
for elem in a:
    if elem not in b:
        res += 1
    b.del(elem)
print(res)


import sys

n = int(sys.stdin.readline())
l1 = [sys.stdin.readline() for loop in range(n)]
l2 = [sys.stdin.readline() for loop in range(n)]

l1.sort()
l2.sort()

c = 0

for loop in range(n):
	for b in range(len(l1[loop])):
		if l1[loop][b] != l2[loop][b]:
			c+=1
print(c)


import sys

n = int(sys.stdin.readline())
l1 = [sys.stdin.readline() for loop in range(n)]
l2 = [sys.stdin.readline() for loop in range(n)]

l1.sort()
l2.sort()

c = 0

for loop in range(n):
	for b in range(len(l1[loop])):
		if l1[loop][b] != l2[loop][b]:
			c+=1
			break
print(c)


import sys

n = int(sys.stdin.readline())
s = list()
t = n
for z in range(n):
	a = sys.stdin.readline()
	find = False
	for loop in range(len(s)):
		if s[loop][0] == a:
			find = True
			s[loop][1] += 1
	if not find:
		s.append([a, 1])
for z in range(n):
	a = sys.stdin.readline()
	find = False
	for loop in range(len(s)):
		if s[loop][0] == a and s[loop][1] > 0:
			find = True
			s[loop][1] -= 1
			t-=1
print(t)


import numpy as np

x = int(input())
list1 = [input() for _ in range(x)]
list2 = [input() for _ in range(x)]
print(len(np.setdiff1d(list2, list1)))


x = int(input())
list1 = []
for i in range(x):
    value = input()
    list1.append(value)

for i in range(x):
    value = input()
    if value in list1:
        list1.remove(value)

print(len(list1))


import numpy as np

x = int(input())
list1 = []
list2 = []

for i in range(x):
    value = input()
    list1.append(value)

for i in range(x):
    value = input()
    list2.append(value)

print(len(np.setdiff1d(list2, list1)))


import numpy as np

x = int(input())
list1 = []
for i in range(x):
    value = input()
    list1.append(value)

for i in range(x):
    value = input()
    if value in list1:
        list1.remove(value)

print(len(list1))


n = int(input())
inp = 0
a = {}
summ = 0
for i in range(0, n):
    inp = input()
    if inp in a:
        a[inp] += 1
    else:
        a[inp] = 1
for i in range(0, n):
    inp = input()
    if inp in a:
        a[inp] -= 1
    else:
        a[inp] = -1
for elem in a:
    summ += abs(int(a[elem]))
print(summ//2)


Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append((len(s),s))
for _ in range(n):
	s=input()
	l2.append((len(s),s))

for i in range(n):
	for j in range(i+1,n):
		if l1[i][0]>l1[j][0] and l1[i][1]>l1[j][1]:
			l1[i],l1[j]=l1[j],l1[i]
for i in range(n):
	for j in range(i+1,n):
		if l2[i][0]>l2[j][0] and l2[i][1]>l2[j][1]:
			l2[i],l2[j]=l2[j],l2[i]
temp=['X','S','M','L']
c=0
for i in range(n):
	x=l1[i][1]
	y=l2[i][1]
	for j in x:
		k=y.find(j)
		if k==-1:
			c+=1
print(c)


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append(s)
for _ in range(n):
	s=input()
	l2.append(s)

l1.sort()
l2.sort()
temp=['X','S','M','L']
c=0
for i in range(n):
	x=l1[i]
	y=l2[i]
	for j in x:
		k=y.find(j)
		if k==-1:
			c+=1
print(c)


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append(s)
for _ in range(n):
	s=input()
	l2.append(s)

l1.sort()
l2.sort()
c=0
for i in range(n):
	if l1[i]==l2[i]:
		continue
	c+=1
print(c)


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append(s)
for _ in range(n):
	s=input()
	l2.append(s)
temp=['L','M','S']
for i in range(1,4):
	f='X'*i
	x=f+'S'
	y=f+'L'
	temp.append(x)
	temp.append(y)
d1,d2={},{}
for i in temp:
	d1.update({i:0})
	d2.update({i:0})
for i in l1:
	d1[i]+=1
for i in l2:
	d2[i]+=1
c=0
for i in temp:
	c=c+abs(d1[i]-d2[i])
print(c//2)


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append((len(s),s))
for _ in range(n):
	s=input()
	l2.append((len(s),s))

for i in range(n):
	for j in range(i+1,n):
		if l1[i][0]>l1[j][0] and l1[i][1]>l1[j][1]:
			l1[i],l1[j]=l1[j],l1[i]
for i in range(n):
	for j in range(i+1,n):
		if l2[i][0]>l2[j][0] and l2[i][1]>l2[j][1]:
			l2[i],l2[j]=l2[j],l2[i]
temp=['X','S','M','L']
c=0
for i in range(n):
	x=l1[i][1]
	y=l2[i][1]
	d1,d2={},{}
	for j in temp:
		d1.update({j:0})
		d2.update({j:0})
	for j in x:
		d1[j]+=1
	for j in y:
		d2[j]+=1
	for j in temp:
		c=c+abs(d1[j]-d2[j])
print(c//2)


l1,l2=[],[]
n=int(input())
for _ in range(n):
	s=input()
	l1.append((len(s),s))
for _ in range(n):
	s=input()
	l2.append((len(s),s))
l1.sort()
l2.sort()
temp=['X','S','M','L']
c=0
for i in range(n):
	x=l1[i][1]
	y=l2[i][1]
	d1,d2={},{}
	for j in temp:
		d1.update({j:0})
		d2.update({j:0})
	for j in x:
		d1[j]+=1
	for j in y:
		d2[j]+=1
	for j in temp:
		c=c+abs(d1[j]-d2[j])
print(c//2)


n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(input())
for i in range(n):
    b.append(input())
a.sort()
b.sort()
ans=0
for i in range(n):
    if a[i]!=b[i]:
        for j in range(len(a[i])):
            if a[i][j]!=b[i][j]:
                ans+=1
print(ans)


n=int(input())
a=[]
b=[]
d={}
for i in range(n):
    a.append(input())
    d[a[i]]=0
for i in range(n):
    b.append(input())
    d[b[i]]=0
for i in a:
    d[i]+=1
for i in b:
    d[i]-=1
ans=0
for i in d:
    ans+=abs(d[i])
print(ans//2)


n = int(input(''))
a = []
b = []
count = 0
j = 0
for x in range(n):
    p = input('')
    a.append(p)
for y in range(n):
    q = input('')
    b.append(q)
a.sort()
b.sort()
for i in range(n):
    if a[i] == b[j]:
        count +=1
    j +=1
print(len(a) - count)


def separator(p):
    c=0;d=0;e=0;f=0;g=0;h=0;k=0;l=0;m=0
    for i in p:
        if i == 'S':
            c+=1
        elif i=='M':
            d+=1
        elif i=='L':
            e+=1
        elif i=='XS':
            f+=1
        elif i=='XXS':
            g+=1
        elif i=='XXXS':
            h+=1
        elif i=='XL':
            k+=1
        elif i=='XXL':
            l+=1
        elif i=='XXXL':
            m+=1
    z = [c,d,e,f,g,h,k,l,m]
    return z
n = int(input(''))
a = []
b = []
count = 0
for x in range(n):
    p = input('')
    a.append(p)
for y in range(n):
    q = input('')
    b.append(q)
z_1 = separator(a)
z_2 = separator(b)
for i in range(9):
    if (z_1[i] - z_2[i]) > 0:
        count = count + (z_1[i] - z_2[i])
print(count)


n=int(input())
p=[]
q=[]
s=0
for x in range(n):
    p.append(input())
for x in range(n):
    q.append(input())
for item in q:
    if item in p:
        p.remove(item)
    else:
        for ite in p:
            if len(item)==len(ite):
                p.remove(ite)
                s+=1
                break
print(s)


n=int(input())
p=[]
q=[]
t=[]
s=0
to=[]
for x in range(n):
    p.append(input())
for x in range(n):
    q.append(input())
for item in q:
    if len(item)!=1:
       if item in p:
            p.remove(item)
       else:
            for ite in p:
               if len(item)==len(ite):
                   p.remove(ite)
                   s+=1
                   break
    else:
        to.append(item)
for x in range(len(to)):
    for item in p:
        if to[x]!=item:
            pass
        else:
            p.remove(item)
print(s+len(p))


n=int(input())
p=[]
q=[]
t=[]
s=0
to=[]
for x in range(n):
    p.append(input())
for x in range(n):
    q.append(input())
for item in q:
    if len(item)!=1:
       if item in p:
            p.remove(item)
       else:
            for ite in p:
               if len(item)==len(ite):
                   p.remove(ite)
                   s+=1
                   break
    else:
        to.append(item)
for x in range(len(to)):
    for item in p:
        if to[x]!=item:
            pass
        else:
            p.remove(item)
            break
print(s+len(p))


n = int(input())

a = {}
for i in range(n):
    x = input()
    if x in a:
        a[x] += 1
    else:
        a[x] = 1

ans = 0
for i in range(n):
    x = input()
    if x in a and a[x] != 0:
        a[x] = a[x]-1
        ans += 1

print(n-ans)


n = int(input())

a =[]
for i in range(n):
    a.append(input())

b =[]
for i in range(n):
    b.append(input())

a.sort()
a.sort(key=len)

b.sort()
b.sort(key=len)

ans = 0
for i in range(n):
    if a[i] != b[i]:
        ans += 1

print(ans)


nos = int(input())
last_year = []
curr_year = []
needed = 0
for i in range(nos):
    last_year.append(input())
for i in range(nos):
    curr_year.append(input())
for x in last_year:
    if x in curr_year:
        curr_year.pop(curr_year.index(x))
    else:

        for indx , v in enumerate(curr_year):
            if len(x) ==1 and len(v) == 1:
                needed += 1
                curr_year.pop(indx)
            elif len(x) == 2 and len(v) == 2:
                needed += 1
                curr_year.pop(indx)
            elif len(x) == 3 and len(v) == 3:
                needed  += 1
                curr_year.pop(indx)
            elif len(x)==4 and len(v) == 4:
                needed += 1
                curr_year.pop(indx)
print(needed)


nos = int(input())
last_year = []
curr_year = []
needed = 0
for i in range(nos):
    last_year.append(input())
for i in range(nos):
    curr_year.append(input())
for i in last_year:
    if i in curr_year:
        curr_year.pop(curr_year.index(i))
print(len(curr_year))


nos = int(input())
last_year = []
curr_year = []
needed = 0
for i in range(nos):
    last_year.append(input())
for i in range(nos):
    curr_year.append(input())
for x in last_year:
    if x in curr_year:
        curr_year.pop(curr_year.index(x))
    else:
        for indx , v in enumerate(curr_year):
            if len(x) ==1 and len(v) == 1 and v not in last_year:
                needed += 1
                curr_year.pop(indx)
            elif len(x) == 2 and len(v) == 2 and v not in last_year:
                needed += 1
                curr_year.pop(indx)
            elif len(x) == 3 and len(v) == 3 and v not in last_year:
                needed  += 1
                curr_year.pop(indx)
            elif len(x)==4 and len(v) == 4 and v not in last_year:
                needed += 1
                curr_year.pop(indx)
print(needed)


n = int(input())
l = [[],[],[],[]]
for i in range(n):
    s = input()
    l[len(s)-1].append(s)
q = [[],[],[],[]]
for i in range(n):
    s = input()
    q[len(s)-1].append(s)

for i in range(4):
    l[i].sort()
    q[i].sort()
c = 0
for k in range(4):
    for i in range(len(q[k])):
        if q[k][i]==l[k][i]:
            c = c
        else:
            c+=1
print(c)


n = int(input())
l = []
for i in range(n):
    l.append(input())
l.sort()
q = []
for i in range(n):
    q.append(input())
q.sort()
c = 0
for i in range(n):
    if len(l[i])==len(q[i]):
        if l[i]!=q[i]:
            c+=1
print(c)


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define For(i,a,b) for(int i=a;i<=b;i++)
#define iFor(i,a,b) for(int i=a;i>=b;i--)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define tr(container,it) \
  for(typeof(container.begin()) it = container.begin();it!=container.end();it++)
const int MOD = 1000000007;

int main(void){
  ios_base::sync_with_stdio(false);   //synchronization off
  cin.tie(NULL);                     //flushing off
  int n;
  cin>>n;
  For(i,0,n-1){
    cin>>a;
    {
  return 0;
}


N = int(input())
a = [input().strip() for i in range(N)]
c = [input().strip() for i in range(N)]
a= sorted(a)
c = sorted(c)
ans = 0
sabu = (abs(a.count("L") - c.count("L")) + abs(a.count("S") - c.count("S")) + abs(a.count("M") - c.count("M")))/2
ans += int(sabu)
tann = a.count("L") + a.count("M") + a.count("S")
for i in range(tann+1,N):
    if a[i] != c[i]:
        ans += 1
print(ans)


N = int(input())
a = [input().strip() for i in range(N)]
c = [input().strip() for i in range(N)]
a= sorted(a)
c = sorted(c)
ans = 0
sabu = (abs(a.count("L") - c.count("L")) + abs(a.count("S") - c.count("S")) + abs(a.count("M") - c.count("M")))/2
ans += int(sabu)
tann = a.count("L") + a.count("M") + a.count("S")
for i in range(tann,N):
    if a[i] != c[i]:
        ans += 1
print(ans)


N = int(input())
a = [input().strip() for i in range(N)]
c = [input().strip() for i in range(N)]
a= sorted(a)
c = sorted(c)
ans = 0
for i in range(N):
    if a[i] != c[i]:
        ans += 1
print(ans)


x = int(input())
if x == 0:
    exit(0)
sizes = []
for i in range(2 * x):
    y = input()
    sizes.append(y)
count = 0
left_side = sorted(sizes[:len(sizes) // 2])
right_side = sorted(sizes[len(sizes) // 2:])

for i in range(len(left_side)):
    if left_side[i] != right_side[i] and len(left_side[i]) == len(right_side[i]):
        count = count + 1
print(count)


x = int(input())

sizes = []
for i in range(x):
    y = input()
    sizes.append(y)

for j in range(x):
    x = input()
    if x in sizes:
        sizes.remove(x)
print(len(sizes))


x = int(input())
sizes = []
for i in range(2 * x):
    y = input()
    sizes.append(y)

left_side = sorted(sizes[:len(sizes) // 2])
right_side = sorted(sizes[len(sizes) // 2:])

count = 0
for i in range(len(left_side)):
    if left_side[i] != right_side[i]:
        count = count + 1
print(count)


x = int(input())
sizes = []
for i in range(2 * x):
    y = input()
    sizes.append(y)

left_side = sizes[:len(sizes) // 2]
right_side = sizes[len(sizes) // 2:]

count = 0
for i in right_side:
    if i not in left_side:
        count = count + 1
print(count)


x = int(input())
if x == 0:
    exit(0)
sizes = []
for i in range(2 * x):
    y = input()
    sizes.append(y)

left_side = sorted(sizes[:len(sizes) // 2])
right_side = sorted(sizes[len(sizes) // 2:])

count = 0
for i in range(len(left_side)):
    if left_side[i] != right_side[i]:
        count = count + 1
print(count)


x = int(input())
sizes = []
for i in range(2 * x):
    y = input()
    sizes.append(y)

left_side = sizes[:len(sizes) // 2]
right_side = sizes[len(sizes) // 2:]

count = 0
for i in right_side:
    if i not in left_side and i in ['M', 'XS', 'XL', 'XXS', 'XXL', 'XXXS', 'XXXL', 'S', 'L']:
        count = count + 1
print(count)


prev = {'XXXS':0,'XXS':0,'XS':0,'S':0,'M':0,'L':0,'XL':0,'XXL':0,'XXXL':0}
curr = {'XXXS':0,'XXS':0,'XS':0,'S':0,'M':0,'L':0,'XL':0,'XXL':0,'XXXL':0}

n = int(input())

for i in range(n):
	val = input()
	prev[val]+=1
for i in range(n):
	val = input()
	curr[val]+=1

diff = 0

for i in prev.keys():
        diff+=abs(prev[i] - curr[i])

print(diff/2)


prev = {'XXXS':0,'XXS':0,'XS':0,'S':0,'M':0,'L':0,'XL':0,'XXL':0,'XXXL':0}
curr = {'XXXS':0,'XXS':0,'XS':0,'S':0,'M':0,'L':0,'XL':0,'XXL':0,'XXXL':0}

n = int(input())

for i in range(n):
	val = input()
	prev[val]+=1
for i in range(n):
	val = input()
	curr[val]+=1

diff = 0

for i in prev.keys():
        diff+=abs(prev[i] - curr[i])

print(diff//2)


n = int(input())
L1 = [ [] for i in range(5) ]
L2 = [ [] for i in range(5) ]
ans = 0
for i in range(n):
    a = input()
    L1[len(a)].append(a)
for j in range(n):
    b = input()
    L2[len(b)].append(b)

s = 0
m = 0
l = 0

for i in L1[1]:
    if i == 'S':
        s += 1
    elif i == 'M':
        m += 1
    else:
        l += 1
s1 = 0
m1 = 0
l1 = 0
for i in L2[1]:
    if i == 'S':
        s1 += 1
    elif i == 'M':
        m1 += 1
    else:
        l1 += 1
ans += (abs(m - m1) + abs(s - s1) + abs(l - l1)) // 2

for i in range(2, 5):
    s = 0
    l = 0
    s1 = 0
    l1 = 0
    for j in range(len(L1[i])):
        if L1[i][j][i - 1] == 'S':
            s += 1
        else:
            l += 1
        if L2[i][j][i - 1] == 'S':
            s1 += 1
        else:
            l1 += 1
    ans += (abs(l - l1) + abs(s - s1)) // 2
print(ans)


n = int(input())
D = dict()
ans = 0
for i in range(n):
    a = input()
    if a not in D.keys():
        D[a] = 1
    else:
        D[a] += 1
for i in range(n):
    b = input()
    if b in D.keys():
        if D[b] != 0:
            D[b] -= 1
        else:
            for j in D.keys():
                if len(b) == len(j) and D[j] != 0:
                    D[j] -= 1
                    ans += 1
    else:
        for j in D.keys():
            if len(b) == len(j) and D[j] != 0:
                D[j] -= 1
                ans += 1
print(ans)


n=int(input())
oldshirts=[]
newshirts=[]
counter=0
for k in range(n):
    k=input()
    oldshirts.append(k)
for i in range(n):
    i=input()
    newshirts.append(i)
for u in range(n):
    if  newshirts[u] in oldshirts:
        oldshirts.remove(newshirts[u])
print(len(oldshirts))


n=int(input())
oldshirts=[]
newshirts=[]
counter=0
for k in range(n):
    k=input()
    oldshirts.append(k)
for i in range(n):
    i=input()
    newshirts.append(i)
for u in range(n):
    if not newshirts[u] in oldshirts:
        counter+=1 #oldshirts.remove(newshirts[u])
print(counter)


n=int(input())
oldshirts=[]
newshirts=[]
counter=0
for k in range(n):
    k=input()
    oldshirts.append(k)
for i in range(n):
    i=input()
    newshirts.append(i)
for u in range(n):
    if not newshirts[u] in oldshirts:
        counter+=1
print(counter)


m = 0
c = 0
l = 0
xl = 0
xxl = 0
xxxl = 0
xs = 0
xxs = 0
xxxs = 0
o = 0
n = int(input())
for i in range (n):
    s = input()
    if s == 'M': m = m+1
    if s == 'S': c = c+1
    if s == 'L': l = l+1
    if s == 'XS': xs = xs+1
    if s == 'XXS': xxs = xxs+1
    if s == 'XXXS': m = xxxs+1
    if s == 'XL': xl = xl+1
    if s == 'XXL': xxl = xxl+1
    if s == 'XXXL': xxxl = xxxl+1
for i in range (n):
    s = input()
    if s == 'M' and m > 0: m = m-1
    if s == 'S'and c > 0: c = c-1
    if s == 'L'and l > 0: l = l-1
    if s == 'XS'and xs > 0: xs = xs-1
    if s == 'XXS'and xxs > 0: xxs = xxs-1
    if s == 'XXXS'and xxxs > 0: m = xxxs-1
    if s == 'XL'and xl > 0: xl = xl-1
    if s == 'XXL'and xxl > 0: xxl = xxl-1
    if s == 'XXXL'and xxxl > 0: xxxl = xxxl-1
o = m +c+l+xl+xxl+xxxl+xs+xxs+xxxs
print (o)


m = 0
c = 0
l = 0
xl = 0
xxl = 0
xxxl = 0
xs = 0
xxs = 0
xxxs = 0
o = 0
n = int(input())
for i in range (n):
    s = input()
    if s == 'M': m = m+1
    if s == 'S': c = c+1
    if s == 'L': l = l+1
    if s == 'XS': xs = xs+1
    if s == 'XXS': xxs = xxs+1
    if s == 'XXXS': xxxs = xxxs+1
    if s == 'XL': xl = xl+1
    if s == 'XXL': xxl = xxl+1
    if s == 'XXXL': xxxl = xxxl+1
for i in range (n):
    s = input()
    if s == 'M' and m > 0: m = m-1
    if s == 'S'and c > 0: c = c-1
    if s == 'L'and l > 0: l = l-1
    if s == 'XS'and xs > 0: xs = xs-1
    if s == 'XXS'and xxs > 0: xxs = xxs-1
    if s == 'XXXS'and xxxs > 0: xxxs = xxxs-1
    if s == 'XL'and xl > 0: xl = xl-1
    if s == 'XXL'and xxl > 0: xxl = xxl-1
    if s == 'XXXL'and xxxl > 0: xxxl = xxxl-1
o = m +c+l+xl+xxl+xxxl+xs+xxs+xxxs
print (o)


n = int(input())
x = [input() for i in range(n)]
y = [input() for i in range(n)]
x.sort()
y.sort()
ans = 0
for i in range(n):
    if x[i] not in y:
        ans += 1

print(ans)


n = int(input())
x = []
y = []
for i in range(n):
    s = input()
    x.append(s)

for i in range(n):
    s = input()
    y.append(s)

def sortByLength(s):
    return len(s)

x.sort(key=sortByLength)
y.sort(key=sortByLength)

ans = 0
for i in range(n):
    for j in range(len(x[i])):
        if x[i][j] != y[i][j]:
            ans += 1

print(ans)


n = int(input())
x = [input() for i in range(n)]
y = [input() for i in range(n)]
x.sort()
y.sort()
ans = 0
while x:
    if x[-1] not in y:
        ans += 1
    else:
        y.pop(y.index(x[-1]))
    x.pop()
print(ans)


n = int(input())
x = []
y = []
for i in range(n):
    s = input()
    x.append(s)

for i in range(n):
    s = input()
    y.append(s)

def sortByLength(s):
    return len(s)

x.sort()
y.sort()

ans = 0
for i in range(n):
    for j in range(len(x[i])):
        if x[i][j] != y[i][j]:
            ans += 1

print(ans)


n = int(input())
x = []
for i in range(n):
    c = input()
    x.append((len(c), c))

x.sort()
s = ''
for i in range(n):
    s += x[i][1]

x = []
for i in range(n):
    c = input()
    x.append((len(c), c))

x.sort()
s2 = ''
for i in range(n):
    s2 += x[i][1]

ans = 0
for i in range(len(s)):
    if s[i] != s2[i]:
        ans += 1

print(ans)


n = int(input())
x = [input() for i in range(n)]
y = [input() for i in range(n)]
x.sort()
y.sort()
ans = 0
for i in range(n):
    if x[i] != y[i]:
        ans += 1

print(ans)


n = int(input())
s = ''
x = [input() for i in range(n)]
x.sort()
for i in range(n):
    s += x[i]

s2 = ''
x = [input() for i in range(n)]
x.sort()
for i in range(n):
    s2 += x[i]

ans = 0
for i in range(len(s)):
    if s[i] != s2[i]:
        ans += 1

print(ans)


n = int(input())
x = []
y = []
for i in range(n):
    s = input()
    x.append((len(s), s))

for i in range(n):
    s = input()
    y.append((len(s), s))

x.sort()
y.sort()

ans = 0
for i in range(n):
    for j in range(len(x[i])):
        if x[i][j] != y[i][j]:
            ans += 1

print(ans)


n= int(input())
a=0; coun=0
li1=[]; li2=[]; li3=[]
for i in range(1,2*n+1):
    if i<=n:
        inp=input()
        if len(inp)==1: li1.append(inp)
        elif len(inp)!=1: li2.append(inp)

    elif i>n:
        inp=input(); leng= len(inp)
        if leng==1 and inp in li1:
            a=0
            b=li1.index(inp)
            li1[b]=''
        elif leng==1 and inp not in li1:
            coun+=1
        elif leng!=1 and inp in li2:
            a=0
            b=li2.index(inp);li2[b]=''
        elif leng!=1 and inp not in li2:
            coun+=1

print(coun)


n= int(input())
a=0; coun=0
li1=[]; li2=[]; li3=[]
for i in range(1,2*n+1):
    if i<=n:
        inp=input()
        if len(inp)==1: li1.append(inp)
        elif len(inp)!=1: li2.append(inp)

    elif i>n:
        inp=input(); leng= len(inp)
        if leng==1 and inp in li1:
            a=0
        elif leng==1 and inp not in li1:
            coun+=1
        elif leng!=1 and inp in li2:
            a=0
        elif leng!=1 and inp not in li2:
            coun+=1

print(coun)


n = int(input())
a = []
b = []
for i in range(n):
		a.append(input())
for i in range(n):
		b.append(input())

used1 = [0]* n
used2 = [0]* n
c = [1]* n
d = [1]* n

for i in range(n):
		for j in range(n):
				if a[i] == b[j] and (used1[i] == 0) and (used2[j] == 0):
						used1[i] = 1
						used2[j] = 1
for i in range(n):
		c[i] = len(a[i])
		d[i] = len(b[i])

s = 0

for i in range(n):
	for j in range(n):
		if (used1[i] == 0) and (used2[j] == 0):
			if c[i] == d[j]:
					used1[i] = 1
					used2[j] = 1
					s += 1
print(s)


n = int(input())
a = []
b = []
for i in range(n):
		a.append(input())
for i in range(n):
		b.append(input())

used1 = [0]* n
used2 = [0]* n
c = [0]* n
d = [0]* n

for i in range(n):
		for j in range(n):
				if a[i] == b[j] and used1[i] == 0 and used2[j] == 0:
						used1[i] = 1
						used2[j] = 1

for i in range(n):
		c[i] = len(a[i])
		d[i] = len(b[i])

s = 0

for i in range(n):
	for j in range(n):
		if (not used1[i]) and (not used2[j]):
			if c[i] == d[j]:
					s += 1
print(s)


n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(input())
for i in range (n):
    b.append(input())
a.sort()
b.sort()
c=0;
vis=[0 for x in range(n)]
for i in range(n):
    for j in range(n):
        if(~vis[j] and a[i]==b[j]):
            vis[j]=1000
            c+=1;

print(n-c);


n=int(input())
a=[]
b=[]
for i in range(n):
    a=input().append()
for i in range (n):
    b=input().append()
a.sort()
b.sort()
c=0;
for i in range(n):
    if(a[i]!=b[i]):
        c+=1
print(c);


n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(input())
for i in range (n):
    b.append(input())
c=0;
vis=[0 for x in range(n)]
for i in range(n):
    for j in range(n):
        if(vis[j]==0 and a[i]==b[j]):
            vis[j]=1
            c+=1;
            break;
print(n-c);


n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(input())
for i in range (n):
    b.append(input())
a.sort()
b.sort()
c=0;
vis=[0 for x in range(n)]
for i in range(n):
    for j in range(n):
        if(vis[j]==0 and a[i]==b[j]):
            vis[j]=1
            c+=1;

print(n-c);


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
# S M L
lenga = [[0,0,0] for _ in range(4)]
lengb = [[0,0,0] for _ in range(4)]

for i in range(n):
  t = 0
  if 'M' in a[i]:
    t = 1
  elif 'L' in a[i]:
    t = 2
  lenga[len(a[i])-1][t] += 1
  s = 0
  if 'M' in b[i]:
    s = 1
  elif 'L' in b[i]:
    s = 2
  lengb[len(b[i])-1][s] += 1
count = 0
for j in range(4):
  tmp = 0
  for k in range(3):
    tmp = max(tmp,(lengb[j][k] - lenga[j][k]))
  count += tmp
print(count)


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
# S M L
lenga = [[0,0,0] for _ in range(4)]
lengb = [[0,0,0] for _ in range(4)]

for i in range(n):
  t = 0
  if 'M' in a[i]:
    t = 1
  elif 'L' in a[i]:
    t = 2
  lenga[len(a[i])-1][t] += 1
  s = 0
  if 'M' in b[i]:
    s = 1
  elif 'L' in b[i]:
    s = 2
  lengb[len(b[i])-1][s] += 1
count = 0
for j in range(4):
  tmp = 0
  for k in range(3):
    tmp = max(tmp,abs(lenga[j][k] - lengb[j][k]))
  count += tmp
print(count)


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
# S M L
lenga = [[0,0,0] for _ in range(4)]
lengb = [[0,0,0] for _ in range(4)]

for i in range(n):
  t = 0
  if 'M' in a[i]:
    t = 1
  elif 'L' in a[i]:
    t = 2
  lenga[len(a[i])-1][t] += 1
  s = 0
  if 'M' in b[i]:
    s = 1
  elif 'L' in b[i]:
    s = 2
  lengb[len(b[i])-1][s] += 1
count = 0
for j in range(4):
  tmp = 0
  for k in range(3):
    tmp = max(tmp,(lenga[j][k] - lengb[j][k]))
  count += tmp
print(count)


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
# S M L
lenga = [[0,0,0] for _ in range(4)]
lengb = [[0,0,0] for _ in range(4)]

for i in range(n):
  if (len(a[i]) == 1 and 'M' in a[i]) or 'M' not in a[i]:
    t = 0
    if 'M' in a[i]:
      t = 1
    elif 'L' in a[i]:
      t = 2
    lenga[len(a[i])-1][t] += 1
  if (len(b[i]) == 1 and 'M' in b[i]) or 'M' not in b[i]:
    s = 0
    if 'M' in b[i]:
      s = 1
    elif 'L' in b[i]:
      s = 2
    lengb[len(b[i])-1][s] += 1
count = 0
for j in range(4):
  tmp = 0
  for k in range(3):
    tmp = max(tmp,(lenga[j][k] - lengb[j][k]))
  count += tmp
print(count)


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
# S M L
lenga = [[0,0,0] for _ in range(4)]
lengb = [[0,0,0] for _ in range(4)]

for i in range(n):
  if (len(a[i]) == 1 and 'M' in a[i]) or 'M' not in a[i]:
    t = 0
    if 'M' in a[i]:
      t = 1
    elif 'L' in a[i]:
      t = 2
    lenga[len(a[i])-1][t] += 1
  if (len(b[i]) == 1 and 'M' in b[i]) or 'M' not in b[i]:
    s = 0
    if 'M' in b[i]:
      s = 1
    elif 'L' in b[i]:
      s = 2
    lengb[len(b[i])-1][s] += 1
count = 0
for j in range(4):
  tmp = 0
  for k in range(3):
    tmp = max(tmp,(lengb[j][k] - lenga[j][k]))
  count += tmp
print(count)


l1=[]; l2=[]; l3=['L', 'M', 'S', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS']; j=0
n=int(input())
for i in range(n):
    l1.append(input())
for i in range(n):
    l2.append(input())
for i in l3:
    j+=abs(l1.count(i)-l2.count(i))
print(j//2)


l1=[]; l2=[]; j=0
n=int(input())
for i in range(n):
    l1.append(input())
for i in range(n):
    l2.append(input())
l1.sort(); l2.sort()
for a,b in (zip(l1,l2)):
    d=abs(sum([ord(c) for c in a])- sum([ord(c) for c in b]))/25
    if d==0:
        pass
    elif d<=1:
        j+=1
    elif d<=2:
        j+=2
    elif d<=3:
        j+=3
    else:
        j+=4
print(j)


l1=[]; l2=[]; j=0
n=int(input())
for i in range(n):
    l1.append(input())
for i in range(n):
    l2.append(input())
l1.sort(); l2.sort()
for a,b in (zip(l1,l2)):
    for c,d in (zip(a,b)):
        if c!=d:
            j+=1
        else:
            pass
print(j)


l1=[]; l2=[]; j=0
n=int(input())
for i in range(n):
    l1.append(input())
for i in range(n):
    l2.append(input())
l1.sort(); l2.sort(); a=b=0
while a<n and b<n:
    if l1[a]==l2[b]:
        a+=1; b+=1
    else:
        if len(l1[a])==len(l2[b]):
            for c,d in (zip(l1[a],l2[b])):
                if c!=d:
                    j+=1
            b+=1
        else:
            while len(l1[a])!=len(l2[b]):
                a+=1
print(j)


def mi():
	return map(int, input().split())

n = int(input())

old = [0]*n
new = [0]*n

for i in range(n):
	old[i] = input()
for i in range(n):
	new[i] = input()

old.sort()
new.sort()
cnt = 0
i = 0

while i<len(old):
	if old[i] in new:
		del(new[new.index(old[i])])
		del(old[i])
	else:
		i+=1
for i in range(len(old)):
	old[i] = sorted(list(old[i]))
	new[i] = sorted(list(new[i]))
	for j in range(len(old[i])):
		if old[i][j]!=new[i][j]:
			cnt+=1
print (cnt)


def mi():
	return map(int, input().split())

n = int(input())

old = [0]*n
new = [0]*n

for i in range(n):
	old[i] = input()
for i in range(n):
	new[i] = input()

old.sort()
new.sort()
cnt = 0
i = 0

while i<len(old):
	if old[i] in new:
		del(new[new.index(old[i])])
		del(old[i])
	i+=1
for i in range(len(old)):
	old[i] = sorted(list(old[i]))
	new[i] = sorted(list(new[i]))
	for j in range(len(old[i])):
		if old[i][j]!=new[i][j]:
			cnt+=1
print (cnt)


def mi():
	return map(int, input().split())

n = int(input())

old = [0]*n
new = [0]*n

for i in range(n):
	old[i] = input()
for i in range(n):
	new[i] = input()

old.sort()
new.sort()
cnt = 0
for i in range(n):
	for j in range(len(old[i])):
		if old[i][j]!=new[i][j]:
			cnt+=1
print (cnt)


c = []
d = []
a = int(input())
for i in range(a):
    b = input()
    c.append(b)
for i in range(a):
    b = input()
    d.append(b)
c.sort()
d.sort()
res = 0
for i in range(a):
    if c[i] != d[i]:
        for j in range(len(c[i])):
            if c[i][j] != d[i][j]:
                res += 1
print(res)


c = []
d = []
a = int(input())
for i in range(a):
    b = input()
    c.append(b)
for i in range(a):
    b = input()
    d.append(b)
c.sort()
d.sort()
res = 0
for i in range(a):
    if c[i] != d[i]:
        res += 1

print(res)


c = {}
d = {}
a = int(input())
for i in range(a):
    b = input()
    if c.get(b) != None:
        c[b] += 1
    else:
        c[b] = 1
for i in range(a):
    b = input()
    if d.get(b) != None:
        d[b] += 1
    else:
        d[b] = 1
res = 0
for i in c:
    if d.get(i) != None:
        k = min(d[i], c[i])
        d[i] -= k
        c[i] -= k
for j in d:
    res += d[j]

print(res)


n=int(input())
a=[]
b=[]
for i in range(n):
	a.append(input())
a=sorted(a)
for i in range(n):
	b.append(input())
b=sorted(b)
r=0
for i in range(n):
	if b[i]!=a[i]:
		r+=1
print(r)


n=int(input())
a=[]
r=0
for i in range(n):
	a.append(input())
for i in range(n):
	t=input()
	if t in a:
		a.remove(t)
print(len(a))


n=int(input())
count1=dict()
count2=dict()
for i in range(n):
    temp=input()
    if(temp in count1):
    	count1[temp]+=1
    else:
    	count1[temp]=1
for i in range(n):
    temp=input()
    if(temp in count2):
    	count2[temp]+=1
    else:
    	count2[temp]=1
for i in count1:
	if i in count2:
		temp=min(count1[i],count2[i])
		count1[i]-=temp
		count2[i]-=temp
a=[];b=[]
for i in count1:
    temp=count1[i]
    while(temp):
        temp-=1
        a.append([len(i),i])
for i in count2:
    temp=count2[i]
    while(temp):
        temp-=1
        b.append([len(i),i])
a=sorted(a)
b=sorted(b)
ans=0
for i in range(len(a)):
    x=a[i][1]
    y=b[i][1]
    for j in range(len(x)):
        if(x[j]!=y[j]):
            ans+=1
print(ans)


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

public class SolC{

    public static boolean getSum(Long[] arr, int start, int end){
        long sum = 0;
        for(int i=start; i<=end; i++){
            sum = sum + arr[i];
        }
        if(sum!=0) return true;
        return false;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = sc.nextInt();
        Long[] arr = new Long[n];

        for(int i=0; i<n; i++){
            arr[i] = sc.nextLong();
        }

        boolean[] dp = new boolean[n+1];

        long ans = 0;

        for(int i=0; i<n; i++){
            if(arr[i]!=0){
                dp[i]=true;
                ans++;
            }
        }

        if(ans==0){
            System.out.println(ans);
            return;
        }

        for(int d=1; d<n; d++){
            for(int i=1; (i+d)<=n; i++){
                dp[i-1] = (getSum(arr, (i-1), (i+d-1)) && dp[i-1] && dp[i]) ? true : false;
                if(dp[i-1]) ans++;
            }
        }

        System.out.println(ans);
    }
}


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

public class SolC{

    public static boolean getSum(Long[] arr, int start, int end){
        long sum = 0;
        for(int i=start; i<=end; i++){
            sum = sum + arr[i];
        }
        if(sum!=0) return true;
        return false;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = sc.nextInt();
        Long[] arr = new Long[n];

        for(int i=0; i<n; i++){
            arr[i] = sc.nextLong();
        }

        boolean[][] dp = new boolean[n][n];

        long ans = 0;

        for(int i=0; i<n; i++){
            if(arr[i]!=0){
                dp[i][i]=true;
                ans++;
            }
        }

        if(ans==0){
            System.out.println(ans);
            return;
        }

        for(int d=1; d<n; d++){
            for(int i=0; (i+d)<n; i++){
                dp[i][i+d] = (getSum(arr, i, (i+d)) && dp[i][i+d-1] && dp[i+1][i+d]) ? true : false;
                if(dp[i][i+d]) ans++;
            }
        }

        System.out.println(ans);
    }
}


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

public class SolC{

    public static boolean getSum(Long[] arr, int start, int end){
        long sum = 0;
        for(int i=start; i<=end; i++){
            sum = sum + arr[i];
        }
        if(sum!=0) return true;
        return false;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = sc.nextInt();
        Long[] arr = new Long[n];

        for(int i=0; i<n; i++){
            arr[i] = sc.nextLong();
        }

        boolean[] dp = new boolean[n+1];

        long ans = 0;

        for(int i=0; i<n; i++){
            if(arr[i]!=0){
                dp[i]=true;
                ans++;
            }
        }

        if(ans==0 || ans==n){
            System.out.println(ans);
            return;
        }

        for(int d=1; d<n; d++){
            for(int i=1; (i+d)<=n; i++){
                dp[i-1] = (getSum(arr, (i-1), (i+d-1)) && dp[i-1] && dp[i]) ? true : false;
                if(dp[i-1]) ans++;
            }
        }

        System.out.println(ans);
    }
}


import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;

public class Main {

    static int[][] vis;

    static void solve(TreeMap<Integer, Integer>rmap, TreeMap<Integer, Integer>gmap, TreeMap<Integer, Integer>bmap){

    }

    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);

        //int tests =sc.nextInt();
        int tests =1;
        OutputStream out = new BufferedOutputStream( System.out );
        for (int z=0;z<tests;z++) {
            int n ,x;
            n = sc.nextInt();
			int [] arr = new int[n];
			for (int i=0; i<n;i++){
				arr[i] = sc.nextInt();
			}
			int ans =0;
			HashSet<Integer > sum = new HashSet<>();
			int[] pref = new int[n+1];

			sum.add(0);
			for (int i=0;i<n;i++){
				pref[i+1] = pref[i] + arr[i];

			}
			int r=1;
			for (int l=0;l<n;l++){
				r = Math.max(r, l+1);
				while (r<=n && !sum.contains(pref[r]-pref[l])){
					sum.add(pref[r]-pref[l]);
					r++;
				}
				ans += r-l-1;
				if (pref[l]!=0)sum.remove(pref[l]);
			}
			System.out.println(ans);

        }

    }
}


import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;

public class Main {

    static int[][] vis;

    static void solve(TreeMap<Integer, Integer>rmap, TreeMap<Integer, Integer>gmap, TreeMap<Integer, Integer>bmap){

    }

    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);

        //int tests =sc.nextInt();
        int tests =1;
        OutputStream out = new BufferedOutputStream( System.out );
        for (int z=0;z<tests;z++) {
            int n ,x;
            n = sc.nextInt();
			int [] arr = new int[n];
			for (int i=0; i<n;i++){
				arr[i] = sc.nextInt();
			}
			long ans =0;
			HashSet<Long > sum = new HashSet<>();
			long[] pref = new long[n+1];

			sum.add((long)0);
			for (int i=0;i<n;i++){
				pref[i+1] = pref[i] + arr[i];

			}
			int r=0;
			for (int l=0;l<n;l++){
				while (r<n && !sum.contains(pref[r+1])){
					r++;
					sum.add((long)pref[r]);
				}
				ans += (long)r-l;
				sum.remove(pref[l]);
			}
			System.out.println(ans);

        }

    }
}