#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<int> C(N);
	for (int i = 0; i < N; i++){
		cin >> C[i];
	}
	int s = 0;
	for (int i = 0; i < N; i++){
		s += C[i];
	}
	int ans = 0;
	for (int i = 0; i < N; i++){
		if (C[i] * 10 <= s){
			ans += 30;
		}
	}
	cout << ans << endl;
}