Imports System
Imports System.Collections.Generic
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 As List(Of Integer) = New List(Of Integer)
        Dim B As List(Of Integer) = New List(Of Integer)
        Dim C As List(Of Integer) = New List(Of Integer)
        For Each ai As String In AAA
            A.Add(ai)
        Next
        For Each bi As String In BBB
            B.Add(bi)
        Next
        For Each ci As String In CCC
            C.Add(ci)
        Next
        A.Sort()
		B.Sort()
        C.Sort()
        Dim count As Integer = 0
        Dim BCcount(n - 1) As Integer
        Dim ABcount(n - 1) As Integer
        Dim p As Integer = 0
        For i As Integer = 0 To n - 1
            BCcount(i) = 0
            For j As Integer = p To n - 1
                If (B(i) < C(j)) Then
                    BCcount(i) += 1
                Else
                    p = j + 1
                End If
            Next
        Next
        Dim q As Integer = 0
        For i As Integer = 0 To n - 1
            ABcount(i) = 0
            For j As Integer = q To n - 1
                If (A(j) < B(i)) Then
                    ABcount(i) += 1
				Else
					q = j + 1
                End If
            Next
        Next
        For k As Integer = 0 To n - 1
            count += ABcount(k) * BCcount(k)
        Next
        Console.WriteLine(count)
	End Sub
End Class