#include <iostream>

using namespace std;

int main(int argc, const char* argv[])
{
	int N;
	cin >> N;
	int C[N];
	for (auto&& c : C) cin >> c;
	int sum = 0;
	for (auto&& c : C) sum += c;
	int cnt = 0;
	int th  = (sum + 10 - 1) / 10;
	for (auto&& c : C) cnt += c <= th;
	cout << 30 * cnt << endl;
	return 0;
}