#include <iostream>
#include <algorithm>

using namespace std;

typedef long long lli;

int main(){
  lli n, h[501];
  cin >> n;
  h[0] = 0;
  for(int i=1;i<=n;i++) cin >> h[i];
  sort(h, h+n);
  lli ans = 0, pre = 0;
  for(int i=1;i<=n;i++){
    //if(h[i] == h[i-1]) continue;
    lli rem = n - i + 1;
    lli id = min(rem / 4, h[i]);
    lli a = rem * (h[i] - h[i-1]);
    lli b = max(0LL, rem * id - rem * pre) - max(0LL, (id * (id + 1) * 2 - pre * (pre + 1) * 2));
    ans += a - b; 
    pre = id;
  }
  cout << ans + 1 << endl;
}