#include using namespace std; int main(){ int N; cin >> N; int k = 0; vector B(101,0); int blocksum = 0; for(int i=1;i<=N;i++){ cin >> B[i]; blocksum += B[i]; } while((k+1)*(k+1)<=blocksum) k++; int ans=0; vector P(101,0); for(int i=1;i<=k;i++){ P[i] = i; P[2*k-i] = i; } for(int i=1;i<=N;i++){ if(B[i]>P[i]) ans += B[i] - P[i]; } cout << ans << endl; return 0; }