Ice-Cream of Montu Mia Again!

Raiyan13 Replay of Intra MU Junior...
Limits 1s, 512 MB

Montu Mia is a student of “Omok School”. He likes to eat an ice-cream every day. But he also likes to
buy that ice-cream with his daily pocket money. His father always gives him maximum pocket money for
the purpose of transportation costs only. Because his mother makes tiffin for him every day.

So, for Montu Mia, the only way to buy an ice-cream is saving money from his transportation cost as much as
he can. There is only one ice-cream shop in his city, so he always goes to that shop and today ingredients
of only one ice-cream is left. As the shop is the only shop and the owner is not so good, so he only gives
icecream to them who give him only 11 note which is the actual price of the ice-cream (if the price is 1010 taka you have to pay exactly 1010 taka note).

You are given nn number of notes Montu Mia has with their value and the mm number of ice-creams on the menu of the shop with their price. You have to help Montu Mia and tell the maximum number of ice-creams he can buy today.

Input

The first line contains a single integer n(1n100)n \hspace{.1cm} (1 \leq n \leq 100) — number of notes given by Montu’s father.

The next line contains nn space separated integers the value of nn notes.

The third line contains a single integer m(1m100)m \hspace{.1cm} (1 \leq m \leq 100) — number of ice-creams presents on shops' menu.

The next line contains mm space separated integers the price of each of the mm ice-creams.

Output

Print an integer, the maximum number of ice-cream he can buy today.

Samples

InputOutput
5
9 2 3 5 13
5
1 4 6 8 13
1
InputOutput
3
5 9 13
2
1 3
0

Submit

Login to submit.

Statistics

70% Solution Ratio
Nowshin_SEarliest, Oct '20
Nowshin_SFastest, 0.0s
Sourav1234Lightest, 0 B
GhostXWaFI_HassanShortest, 120B
Toph uses cookies. By continuing you agree to our Cookie Policy.