Imports System

Public Class Test
	Public Shared Sub Main()
        Dim n As Integer
        Dim AA As String
        Dim BB As String
        Dim CC As String
        Dim AAA As String()
        Dim BBB As String()
        Dim CCC As String()
        n = Console.ReadLine()
        AA = Console.ReadLine()
        BB = Console.ReadLine()
        CC = Console.ReadLine()
        AAA = AA.Split(" "c)
        BBB = BB.Split(" "c)
        CCC = CC.Split(" "c)
    Dim a(n-1) as integer
    dim b(n-1) as integer
    dim c(n-1) as integer
    dim k as integer=0
        For Each ai As String In AAA
            a(k)=ai
    		k+=1
        Next
  		k=0
        For Each bi As String In BBB
            b(k)=bi
  			k+=1
        Next
		k=0
		For Each ci As String In CCC
            c(k)=ci
			k+=1
        Next
        Dim count As Integer = 0
        Dim BCcount(n - 1) As Integer
        For i As Integer = 0 To n - 1
            BCcount(i) = 0
            For j As Integer = 0 To n - 1
                If (b(i) < c(j)) Then
                    BCcount(i) += 1
                End If
            Next
        Next
        For x As Integer = 0 To n - 1
            For y As Integer = 0 To n - 1
                If (a(x) < b(y)) Then
                    count += BCcount(y)
                End If
            Next
        Next
        Console.WriteLine(count)
	End Sub
End Class