#include using namespace std; int main() { int N; cin >> N; vector C(N); int x = 0, y = 0; for (int i = 0; i < N; i++) { cin >> C.at(i); x += C.at(i) / 10; } while (N--) if (C.at(N) <= x) y++; cout << y * 30 << "\n"; }