from bisect import bisect_right
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    aa = LI()
    bb = LI()
    dd = LI()
    dd.sort()
    # dp[i][j]kenがi回、kooがj回飲んだとき、何番目の問題まで進んだかの最大値
    dp = [[-1] * (n + 1) for _ in range(n + 1)]
    dp[0][0] = n
    # 2人合わせてs回のんだとき
    dpi1=dp[0]
    for i in range(n):
        dpi=dpi1
        dpi1=dp[i+1]
        for j in range(n):
            pre = dpi[j]
            if pre < 1: continue
            # iを進める場合
            di = bisect_right(dd, aa[i + 1] + bb[j], 0, pre) - 1
            if di > dpi1[j]: dpi1[j] = di
            # jを進める場合
            di = bisect_right(dd, aa[i] + bb[j + 1], 0, pre) - 1
            if di > dpi[j + 1]: dpi[j + 1] = di
    #p2D(dp)
    for s in range(n,-1,-1):
        for i in range(n+1):
            j=s-i
            if dp[i][j]>-1:
                print(s)
                exit()
main()