/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		
		int a[]=new int[n];
			int b[]=new int[n];
				int c[]=new int[n];
					int d[]=new int[n];
						int e[]=new int[n];
						
						for(int i=0;i<n;i++)
						a[i]=sc.nextInt();
						
						for(int j=0;j<n;j++)
						b[j]=sc.nextInt();
						
						for(int k=0;k<n;k++)
						c[k]=sc.nextInt();
						
						for(int l=0;l<n;l++)
						d[l]=sc.nextInt();
						
						for(int m=0;m<n;m++)
						e[m]=sc.nextInt();
						
						//storing the sum of the last 2 array values in hashmap
						Map<Integer,Integer> m=new HashMap<>();
						
					//storing the sum of the last 2 array values in hashmap
					for(int i=0;i<n;i++)
					{
						for(int j=0;j<n;j++)
						{
							int sum=d[i]+e[j];
							m.put(sum,m.getOrDefault(sum,0)+1);
						}
					}
					
					
					int ans=0;
					for(int i=0;i<n;i++)
					{
						for(int j=0;j<n;j++)
						{
							for(int k=0;k<n;k++)
							{
								int val=a[i]+b[j]+c[k];
								if(m.containsKey(-val))
								ans+=m.get(-val);
							}
						}
					}
					
					System.out.println(ans);
					
						
	}
}