#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main()
{
    INIT;

    int n;
    cin >> n;
    int C[n], total = 0;
    REP(i, n){
        cin >> C[i];
        total += C[i];
    }

    int hoge = total / 10;
    int fans = 0;
    REP(i, n){
        if(C[i] <= hoge) fans += 30;
    }
    cout << fans << endl;

    return 0;
}