As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest.

The New Year contest begins at 18:00 (6.00 P.M.) on December 31 and ends at 6:00 (6.00 A.M.) on January 1. There are *n* problems for the contest. The penalty time for each solved problem is set as the distance from the moment of solution submission to the New Year in minutes. For example, the problem submitted at 21:00 (9.00 P.M.) gets penalty time 180, as well as the problem submitted at 3:00 (3.00 A.M.). The total penalty time is calculated as the sum of penalty time for all solved problems. It is allowed to submit a problem exactly at the end of the contest, at 6:00 (6.00 A.M.).

Gennady opened the problems exactly at 18:00 (6.00 P.M.) and managed to estimate their complexity during the first 10 minutes of the contest. He believes that writing a solution for the *i*-th problem will take *a*<sub class="lower-index">*i*</sub> minutes. Gennady can submit a solution for evaluation at any time after he completes writing it. Probably he will have to distract from writing some solution to send the solutions of other problems for evaluation. The time needed to send the solutions can be neglected, i.e. this time can be considered to equal zero. Gennady can simultaneously submit multiple solutions. Besides, he can move at any time from writing one problem to another, and then return to the first problem from the very same place, where he has left it. Thus the total solution writing time of the *i*-th problem always equals *a*<sub class="lower-index">*i*</sub> minutes. Of course, Gennady does not commit wrong attempts, and his solutions are always correct and are accepted from the first attempt. He can begin to write the solutions starting from 18:10 (6.10 P.M.).

Help Gennady choose from the strategies that help him solve the maximum possible number of problems, the one with which his total penalty time will be minimum.
The first line contains an integer *n* (1 ≤ *n* ≤ 100) — the number of the problems. The next line contains *n* space-separated integers *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 720) — each number shows how much time in minutes Gennady will spend writing a solution to the problem.
3
30 330 720
2 10
1
720
0 0
5
100 200 300 400 500
3 250
7
120 110 100 110 120 120 50
6 420
3
350 340 360
2 340
8
150 100 50 70 70 80 90 100
8 690
100
18 96 216 240 1 114 126 38 7 72 28 1 8 29 5 93 1 56 50 142 79 30 6 7 13 126 49 154 6 44 116 3 120 17 181 36 32 7 33 41 59 88 20 21 77 110 7 23 99 15 49 151 68 68 52 28 101 33 119 97 1 9 12 33 17 50 64 181 1 19 51 3 16 59 96 88 6 30 5 15 32 142 71 27 10 6 5 86 26 13 116 47 118 93 36 15 46 264 41 40
47 2117
100
4 60 3 39 122 105 13 19 22 10 12 8 48 11 26 53 35 21 54 3 102 69 26 65 2 66 3 19 2 14 16 12 39 8 1 18 35 62 59 30 29 40 7 15 15 8 36 69 72 28 44 99 38 53 18 43 19 66 51 5 6 15 35 35 16 48 26 73 6 52 31 33 4 105 7 9 42 20 17 43 17 20 20 1 18 33 59 57 14 10 4 7 23 34 52 147 69 11 21 147
54 2826
100
7 113 22 3 8 57 14 11 5 10 41 22 27 42 2 23 9 7 14 57 42 4 15 14 25 9 1 3 9 17 36 3 46 42 1 16 31 3 86 36 48 9 1 31 24 7 6 59 46 37 6 5 13 1 29 5 45 12 13 2 60 23 33 28 31 53 6 33 3 6 85 13 5 16 21 4 5 56 11 21 1 47 86 25 10 8 26 29 30 5 15 21 28 26 1 44 15 59 39 88
64 2619
100
6 4 5 6 6 4 3 2 7 1 23 1 7 3 1 1 13 3 2 9 13 8 11 6 2 5 3 3 1 3 6 3 26 11 16 21 7 21 15 1 10 3 2 7 4 11 2 20 2 9 15 10 16 17 3 7 6 4 5 4 1 2 1 1 13 7 6 4 6 5 22 5 14 12 2 30 2 30 5 14 3 4 9 2 9 3 1 3 9 4 3 6 3 15 21 23 3 6 14 22
97 3395
100
6 2 1 1 6 3 1 1 3 2 2 2 3 2 3 1 6 1 6 1 2 1 2 2 4 2 2 1 1 3 2 6 1 1 8 4 2 1 3 1 2 6 7 2 1 1 1 2 1 1 1 2 4 1 3 1 2 3 1 1 1 1 2 3 1 1 3 3 1 1 1 5 2 1 1 3 2 1 1 1 6 3 2 8 9 3 1 13 1 1 1 1 1 1 1 4 2 3 8 3
100 0
100
5 20 2 8 1 1 1 1 4 2 1 1 1 7 8 4 2 2 3 2 1 8 3 3 3 2 8 6 1 11 14 4 18 3 2 7 3 1 1 4 1 4 1 13 1 8 1 1 5 7 3 1 2 1 3 3 3 16 6 7 4 2 1 7 3 2 4 1 2 6 1 4 4 3 1 6 2 4 8 3 1 3 4 4 2 10 1 1 8 2 1 2 1 1 3 2 2 1 2 2
100 54
100
11 3 1 2 2 13 19 1 1 6 17 1 13 5 6 1 8 6 2 2 5 2 1 8 5 7 24 3 1 7 13 14 1 3 15 2 8 11 1 4 7 2 13 3 17 4 1 5 2 4 3 1 4 1 2 6 2 4 3 2 9 3 1 10 1 3 1 3 2 2 10 7 2 1 5 2 1 9 4 7 11 5 2 8 5 8 1 2 1 5 2 1 18 4 4 1 1 1 6 3
100 808
10
156 92 20 51 43 37 53 76 61 121
10 647
25
77 2 5 13 26 127 6 32 6 9 26 34 3 31 13 55 4 2 7 39 12 27 12 43 99
25 786
50
10 10 1 22 4 1 5 1 13 12 14 12 36 30 9 20 5 13 1 4 2 36 21 3 10 5 25 12 10 6 22 5 21 17 1 3 50 44 3 11 9 7 3 59 1 24 34 7 19 17
50 1665
93
6 30 24 3 4 1 2 10 10 11 7 8 2 11 19 3 1 13 12 1 3 4 9 5 8 1 1 2 3 11 7 1 1 12 3 2 1 7 8 3 11 8 11 14 6 1 4 8 5 5 26 3 1 7 4 1 19 5 2 2 2 14 10 14 9 11 5 6 8 26 3 3 3 1 26 27 12 3 21 4 2 3 7 4 8 1 27 3 1 1 5 22 5
93 2878
98
7 4 20 4 2 2 1 3 7 16 3 1 20 9 15 12 4 1 3 5 11 9 3 6 4 5 3 8 4 19 11 8 3 27 8 3 29 19 2 9 1 9 6 12 9 10 6 13 5 1 5 4 3 21 2 2 2 4 10 5 1 1 2 9 4 3 6 5 9 1 16 9 1 6 8 4 2 1 4 4 9 9 8 13 23 1 3 2 15 8 2 5 11 3 8 13 2 19
98 3398
100
9 1 2 5 9 4 6 1 6 8 4 1 13 9 5 1 2 2 5 2 12 11 10 16 4 8 9 13 5 11 1 5 7 11 7 12 1 3 5 3 3 15 7 26 13 7 8 10 6 23 8 1 5 8 18 14 3 16 15 1 14 14 6 5 5 3 22 5 9 4 1 7 9 3 1 12 7 1 11 4 1 3 12 2 5 7 17 2 5 5 9 2 4 2 4 2 6 9 13 1
100 4002
100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
37 2014
100
17 8 50 10 8 4 41 16 15 1 5 47 58 33 9 105 13 1 31 22 5 7 45 23 49 41 1 44 6 5 18 3 28 3 1 31 27 12 52 32 2 3 4 29 14 20 24 12 21 6 2 13 16 23 11 19 11 10 1 30 19 33 12 6 29 7 33 4 14 55 1 16 12 17 2 28 34 22 17 5 15 2 15 9 4 14 41 37 19 24 6 61 5 56 49 43 20 3 9 10
69 3288
100
46 353 325 357 342 31 186 689 447 377 484 297 517 92 408 336 389 651 346 464 521 670 353 577 73 477 21 84 659 180 454 386 274 425 274 8 306 131 688 313 342 144 589 277 225 520 442 704 72 376 334 200 92 180 205 602 138 286 668 39 714 447 477 684 491 38 44 186 274 614 127 5 585 566 242 578 361 445 550 311 31 719 638 357 401 125 496 684 598 133 479 320 715 552 539 34 134 674 97 165
15 915
100
13 28 8 18 4 30 69 49 2 18 10 9 8 22 17 19 2 23 1 30 17 7 8 39 8 4 9 23 22 16 20 11 12 60 5 50 4 12 5 6 2 7 8 21 14 10 27 6 37 9 14 20 46 11 6 27 5 10 4 1 36 6 57 2 26 1 14 3 2 4 57 2 37 15 6 16 15 6 4 15 44 13 21 25 7 26 40 3 17 30 20 7 18 9 48 12 11 5 16 2
73 3313
100
22 13 1 3 2 18 11 11 40 42 1 3 1 12 3 16 32 4 15 18 7 8 4 6 1 1 19 7 2 17 12 21 2 2 9 8 14 29 9 19 5 5 18 15 9 12 7 13 32 41 27 3 9 30 27 8 12 8 60 1 25 34 3 8 24 4 29 12 1 3 41 19 13 14 47 1 40 16 45 12 25 3 8 29 6 5 2 11 10 9 28 1 13 2 27 2 8 12 7 3
80 3381
100
4 5 7 13 8 3 11 4 3 8 1 4 5 11 2 5 5 20 10 1 16 24 14 14 23 20 2 2 1 12 17 11 5 6 21 1 16 25 4 3 24 17 4 9 22 6 4 40 5 8 10 20 3 13 14 10 2 21 25 3 37 4 19 3 3 6 5 12 1 15 4 2 3 40 8 1 6 20 2 3 8 26 29 2 14 12 2 2 2 1 9 5 10 10 1 4 1 19 18 2
90 3463
1
710
1 360
100
6 14 7 4 3 1 18 3 17 6 4 44 3 2 17 19 4 6 1 11 11 7 3 8 2 1 7 2 16 1 16 10 6 2 17 6 1 4 3 4 3 2 2 5 6 6 2 2 1 2 2 5 3 1 9 3 6 1 20 12 1 4 4 1 8 19 14 8 1 2 26 5 9 2 4 4 7 6 2 2 10 1 15 2 1 12 6 7 5 26 29 16 6 8 1 11 1 8 1 5
100 2907
100
1 6 17 3 4 1 2 10 1 3 18 10 5 4 6 17 8 1 11 11 2 3 14 1 2 1 15 14 6 4 5 1 31 1 3 13 4 2 22 4 3 7 7 2 2 5 1 5 11 2 6 9 2 12 17 1 3 2 3 7 8 4 7 8 4 2 5 3 6 12 20 2 28 2 22 11 1 7 2 11 11 2 1 5 7 1 8 2 7 6 7 7 3 9 8 5 24 22 4 12
100 3245
5
1 1 1 1 1
5 0
1
5
1 0
1
711
0 0
1
10
1 0
n=int(input())
a=str(input()).split()
a=map(int,a)
a=sorted(a)
s=10
x=0
for i in range(n):
    x+=a[i]
if x<360:
    k=n
    s=0
else:
    i=0
    while 360 >= (s+a[i]):
        s+=a[i]
        i+=1
    k=i
    if k !=0:
        a[i]=a[i]-360+s
        s=0
        while (s+a[i]) <=360:
            s+=a[i]
            k+=1
            i+=1
            if i==n:
                x=s
                s=370
                i-=1
            
    else:
        k=1
        s=a[0]-350
if s==370:
    s=x
print(k,' ',s)
