Language: C++

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

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL s[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++) c[i]=read();
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	for (int i=1;i<=n;i++) s[i]=lower_bound(a+1,a+n+1,b[i])-a-1;
	for (int i=1;i<=n;i++) s[i]+=s[i-1];
	LL ans=0;
	for (int i=1;i<=n;i++)
	{
		int x=lower_bound(b+1,b+n+1,c[i])-b-1;
		ans+=s[x];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc:42:2: error: stray '#' in program
   42 | }#include<iostream>
      |  ^
a.cc:83:2: error: stray '#' in program
   83 | }#include<iostream>
      |  ^
a.cc:124:2: error: stray '#' in program
  124 | }#include<iostream>
      |  ^
a.cc:165:2: error: stray '#' in program
  165 | }#include<iostream>
      |  ^
a.cc:206:2: error: stray '#' in program
  206 | }#include<iostream>
      |  ^
a.cc:247:2: error: stray '#' in program
  247 | }#include<iostream>
      |  ^
a.cc:288:2: error: stray '#' in program
  288 | }#include<iostream>
      |  ^
a.cc:329:2: error: stray '#' in program
  329 | }#include<iostream>
      |  ^
a.cc:370:2: error: stray '#' in program
  370 | }#include<iostream>
      |  ^
a.cc:411:2: error: stray '#' in program
  411 | }#include<iostream>
      |  ^
a.cc:452:2: error: stray '#' in program
  452 | }#include<iostream>
      |  ^
a.cc:493:2: error: stray '#' in program
  493 | }#include<iostream>
      |  ^
a.cc:534:2: error: stray '#' in program
  534 | }#include<iostream>
      |  ^
a.cc:575:2: error: stray '#' in program
  575 | }#include<iostream>
      |  ^
a.cc:616:2: error: stray '#' in program
  616 | }#include<iostream>
      |  ^
a.cc:657:2: error: stray '#' in program
  657 | }#include<iostream>
      |  ^
a.cc:698:2: error: stray '#' in program
  698 | }#include<iostream>
      |  ^
a.cc:739:2: error: stray '#' in program
  739 | }#include<iostream>
      |  ^
a.cc:780:2: error: stray '#' in program
  780 | }#include<iostream>
      |  ^
a.cc:821:2: error: stray '#' in program
  821 | }#include<iostream>
      |  ^
a.cc:862:2: error: stray '#' in program
  862 | }#include<iostream>
      |  ^
a.cc:903:2: error: stray '#' in program
  903 | }#include<iostream>
      |  ^
a.cc:944:2: error: stray '#' in program
  944 | }#include<iostream>
      |  ^
a.cc:985:2: error: stray '#' in program
  985 | }#include<iostream>
      |  ^
a.cc:1026:2: error: stray '#' in program
 1026 | }#include<iostream>
      |  ^
a.cc:1067:2: error: stray '#' in program
 1067 | }#include<iostream>
      |  ^
a.cc:1108:2: error: stray '#' in program
 1108 | }#include<iostream>
      |  ^
a.cc:42:3: error: 'include' does not name a type
   42 | }#include<iostream>
      |   ^~~~~~~
a.cc:51:11: error: redefinition of 'const int N'
   51 | const int N=100005;
      |           ^
a.cc:10:11: note: 'const int N' previously defined here
   10 | const int N=100005;
      |           ^
a.cc:53:5: error: redefinition of 'int n'
   53 | int n,a[N],b[N],c[N];
      |     ^
a.cc:12:5: note: 'int n' previously declared here
   12 | int n,a[N],b[N],c[N];
      |     ^
a.cc:53:7: error: redefinition of 'int a [100005]'
   53 | int n,a[N],b[N],c[N];
      |       ^
a.cc:12:7: note: 'int a [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |       ^
a.cc:53:12: error: redefinition of 'int b [100005]'
   53 | int n,a[N],b[N],c[N];
      |            ^
a.cc:12:12: note: 'int b [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |            ^
a.cc:53:17: error: redefinition of 'int c [100005]'
   53 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:12:17: note: 'int c [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:54:4: error: redefinition of 'LL s [100005]'
   54 | LL s[N];
      |    ^
a.cc:13:4: note: 'LL s [100005]' previously declared here
   13 | LL s[N];
      |    ^
a.cc:56:5: error: redefinition of 'int read()'
   56 | int read()
      |     ^~~~
a.cc:15:5: note: 'int read()' previously defined here
   15 | int read()
      |     ^~~~
a.cc:64:5: error: redefinition of 'int main()'
   64 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~
a.cc:83:3: error: 'include' does not name a type
   83 | }#include<iostream>
      |   ^~~~~~~
a.cc:92:11: error: redefinition of 'const int N'
   92 | const int N=100005;
      |           ^
a.cc:10:11: note: 'const int N' previously defined here
   10 | const int N=100005;
      |           ^
a.cc:94:5: error: redefinition of 'int n'
   94 | int n,a[N],b[N],c[N];
      |     ^
a.cc:12:5: note: 'int n' previously declared here
   12 | int n,a[N],b[N],c[N];
      |     ^
a.cc:94:7: error: redefinition of 'int a [100005]'
   94 | int n,a[N],b[N],c[N];
      |       ^
a.cc:12:7: note: 'int a [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |       ^
a.cc:94:12: error: redefinition of 'int b [100005]'
   94 | int n,a[N],b[N],c[N];
      |            ^
a.cc:12:12: note: 'int b [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |            ^
a.cc:94:17: error: redefinition of 'int c [100005]'
   94 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:12:17: note: 'int c [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:95:4: error: redefinition of 'LL s [100005]'
   95 | LL s[N];
      |    ^
a.cc:13:4: note: 'LL s [100005]' previously declared here
   13 | LL s[N];
      |    ^
a.cc:97:5: error: redefinition of 'int read()'
   97 | int read()
      |     ^~~~
a.cc:15:5: note: 'int read()' previously defined here
   15 | int read()
      |     ^~~~
a.cc:105:5: error: redefinition of 'int main()'
  105 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~
a.cc:124:3: error: 'include' does not name a type
  124 | }#include<iostream>
      |   ^~~~~~~
a.cc:133:11: error: redefinition of 'const int N'
  133 | const int N=100005;
      |           ^
a.cc:10:11: note: 'const int N' previously defined here
   10 | const int N=100005;
      |           ^
a.cc:135:5: error: redefinition of 'int n'
  135 | int n,a[N],b[N],c[N];
      |     ^
a.cc:12:5: note: 'int n' previously declared here
   12 | int n,a[N],b[N],c[N];
      |     ^
a.cc:135:7: error: redefinition of 'int a [100005]'
  135 | int n,a[N],b[N],c[N];
      |       ^
a.cc:12:7: note: 'int a [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |       ^
a.cc:135:12: error: redefinition of 'int b [100005]'
  135 | int n,a[N],b[N],c[N];
      |            ^
a.cc:12:12: note: 'int b [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |            ^
a.cc:135:17: error: redefinition of 'int c [100005]'
  135 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:12:17: note: 'int c [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:136:4: error: redefinition of 'LL s [100005]'
  136 | LL s[N];
      |    ^
a.cc:13:4: note: 'LL s [100005]' previously declared here
   13 | LL s[N];
      |    ^
a.cc:138:5: error: redefinition of 'int read()'
  138 | int read()
      |     ^~~~
a.cc:15:5: note: 'int read()' previously defined here
   15 | int read()
      |     ^~~~
a.cc:146:5: error: redefinition of 'int main()'
  146 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~
a.cc:165:3: error: 'include' does not name a type
  165 | }#include<iostream>
      |   ^~~~~~~
a.cc:174:11: error: redefinition of 'const int N'
  174 | const int N=100005;
      |           ^
a.cc:10:11: note: 'const int N' previously defined here
   10 | const int N=100005;
      |           ^
a.cc:176:5: error: redefinition of 'int n'
  176 | int n,a[N],b[N],c[N];
      |     ^
a.cc:12:5: note: 'int n' previously declared here
   12 | int n,a[N],b[N],c[N];
      |     ^
a.cc:176:7: error: redefinition of 'int a [100005]'
  176 | int n,a[N],b[N],c[N];
      |       ^
a.cc:12:7: note: 'int a [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |       ^
a.cc:176:12: error: redefinition of 'int b [100005]'
  176 | int n,a[N],b[N],c[N];
      |            ^
a.cc:12:12: note: 'int b [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |            ^
a.cc:176:17: error: redefinition of 'int c [100005]'
  176 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:12:17: note: 'int c [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:177:4: error: redefinition of 'LL s [100005]'
  177 | LL s[N];
      |    ^
a.cc:13:4: note: 'LL s [100005]' previously declared here
   13 | LL s[N];
      |    ^
a.cc:179:5: error: redefinition of 'int read()'
  179 | int read()
      |     ^~~~
a.cc:15:5: note: 'int read()' previously defined here
   15 | int read()
      |     ^~~~
a.cc:187:5: error: redefinition of 'int main()'
  187 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~
a.cc:206:3: error: 'include' does not name a type
  206 | }#include<iostream>
      |   ^~~~~~~
a.cc:215:11: error: redefinition of 'const int N'
  215 | const int N=100005;
      |           ^
a.cc:10:11: note: 'const int N' previously defined here
   10 | const int N=100005;
      |           ^
a.cc:217:5: error: redefinition of 'int n'
  217 | int n,a[N],b[N],c[N];
      |     ^
a.cc:12:5: note: 'int n' previously declared here
   12 | int n,a[N],b[N],c[N];
      |     ^
a.cc:217:7: error: redefinition of 'int a [100005]'
  217 | int n,a[N],b[N],c[N];
      |       ^
a.cc:12:7: note: 'int a [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |       ^
a.cc:217:12: error: redefinition of 'int b [100005]'
  217 | int n,a[N],b[N],c[N];
      |            ^
a.cc:12:12: note: 'int b [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |            ^
a.cc:217:17: error: redefinition of 'int c [100005]'
  217 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:12:17: note: 'int c [100005]' previously declared here
   12 | int n,a[N],b[N],c[N];
      |                 ^
a.cc:218:4: error: redefinition of 'LL s [100005]'
  218 | LL s[N];
      |    ^
a.cc:13:4: note: 'LL s [100005]' previously declared here
   13 | LL s[N];
      |    ^
a.cc:220:5: error: redefinition of 'int read()'
  220 | int read()
      |     ^~~~
a.cc:15:5: note: 'int read()' previously defined here
   15 | int read()
      |     ^~~~
a.cc:228:5: error: redefinition of 'int main()'
  228 | int main()
      |     ^~~~
a.cc:23:5: note: 'i