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 i As Integer = 0
        For Each ai In AAA
            a(i) = CInt(ai)
            i += 1
        Next
        i = 0
        For Each bi In BBB
            b(i) = CInt(bi)
            i += 1
        Next
        i = 0
        For Each ci In CCC
            c(i) = CInt(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