4
1 10 7 4
15 3 8 7
250

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright ? 2015 shivam <shivam@Infinite-Tsukuyomi>
#
# Distributed under terms of the MIT license.


def find(f,m,l,s):
    if l==-1:
        return s
    if m[l] > f[l]:
        f.pop(0)
        m.pop(l)
        return find(f,m,l-1,s)
    elif m[l] < f[l]:
        f.pop(l)
        m.pop(l)
        return find(f,m,l-1,s+100)
    else:
        return max(find(f[:l],m[:l],l-1,s+50),find(f[1:],m[:l],l-1,s))
t = input()
f = map(int,raw_input().split(' '))
m = map(int,raw_input().split(' '))
f.sort()
m.sort()
print find(f,m,len(f)-1,0)