from bisect import * N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) D = list(map(int, input().split())) D.sort() dp = [[-1]*(N+1) for _ in range(N+1)] dp[0][0] = (N, 0) for i in range(N+1): for j in range(N+1): if i+j>N: break if i==0 and j==0: continue if i>0: idx1, solved1 = dp[i-1][j] if j>0: idx2, solved2 = dp[i][j-1] mark = bisect_right(D, A[i]+B[j]) if i!=0 and (j==0 or (solved1==solved2 and idx1>idx2) or solved1>solved2): if mark==0 or idx1==0: dp[i][j] = (idx1, solved1) else: if mark-1>=idx1: dp[i][j] = (idx1-1, solved1+1) else: dp[i][j] = (mark-1, solved1+1) else: if mark==0 or idx2==0: dp[i][j] = (idx2, solved2) else: if mark-1>=idx2: dp[i][j] = (idx2-1, solved2+1) else: dp[i][j] = (mark-1, solved2+1) ans = 0 for i in range(N+1): ans = max(ans, dp[i][N-i][1]) print(ans)