import std.array, std.stdio, std.string, std.algorithm, std.conv;


void main()
{
    int N = readln.strip.to!int;
    long[] C = readln.split.map!(to!long).array;
    long sum = C.reduce!"a + b";
    writeln(C.filter!(a => a <= sum / 10).count * 30);
}