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
        n = Console.ReadLine()
        AA = Console.ReadLine()
        BB = Console.ReadLine()
        CC = Console.ReadLine()
    Dim AAA As String() = AA.Split(" "c)
    Dim BBB As String() = BB.Split(" "c)
    Dim CCC As String() = CC.Split(" "c)
        Dim a(n - 1) As Integer
        Dim b(n - 1) As Integer
        Dim c(n - 1) As Integer
        Dim i As Integer = 0
	    For Each ai As String In AAA
            a(i) = ai
            i += 1
        Next
        i = 0
  		For Each bi As String In BBB
            b(i) = bi
            i += 1
        Next
        i = 0
		For Each ci As String In CCC
            c(i) = ci
            i += 1
        Next
        Dim count As Integer = 0
        For x As Integer = 0 To n - 1
            For y As Integer = 0 To n - 1
                If (b(y) > a(x)) Then
                    For z As Integer = 0 To n - 1
                        If (c(z) > b(y)) Then
                            count += 1
                        End If
                    Next z
                End If
            Next y
        Next x
        Console.WriteLine(count)
	End Sub
End Class