#include <bits/stdc++.h>   using namespace std;   struct ter {     int cx, cy, dir, pt, rem;     ter(){};     ter(int _cx, int _cy, int _dir, int _pt, int _rem)         : cx(_cx), cy(_cy), dir(_dir), pt(_pt), rem(_rem){};   };   const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};   const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1};   ter on;   queue<ter> Q;   int n, t[32], cx, cy, dir, pt, rem, dir1, dir2, sol, maxx = -3;   bool bio[312][312][8][31][6], mp[312][312];   void radi() {     while (!Q.empty()) {       on = Q.front();       cx = on.cx;       cy = on.cy;       dir = on.dir;       pt = on.pt;       rem = on.rem;       Q.pop();       if (bio[cx][cy][dir][pt][rem]) continue;       bio[cx][cy][dir][pt][rem] = 1;       if (mp[cx][cy] == 0) ++sol;       mp[cx][cy] = 1;       if (rem > 0) {         Q.push(ter(cx + dx[dir], cy + dy[dir], dir, pt, rem - 1));       } else {         if (pt == n) continue;         dir1 = (dir + 1) % 8;         dir2 = (dir + 7) % 8;         Q.push(ter(cx + dx[dir1], cy + dy[dir1], dir1, pt + 1, t[pt + 1] - 1));         Q.push(ter(cx + dx[dir2], cy + dy[dir2], dir2, pt + 1, t[pt + 1] - 1));       }     }   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; ++i) cin >> t[i];     Q.push(ter(155, 155, 0, 1, t[1] - 1));     radi();     cout << sol << endl;     return 0;   }   