#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30 + 5;
int t[MAXN];
int n, ans = 0;
bool Mp[6][8][400][400], C[400][400];
int dir[8][2] = {{0, 1},  {1, 1},   {1, 0},  {1, -1},
                 {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}};
struct node {
  int x, y, cnt, dp, dir;
  node() {}
  node(int _x, int _y, int _cnt, int _dp, int _dir)
      : x(_x), y(_y), cnt(_cnt), dp(_dp), dir(_dir) {}
};
bool judge(int x, int y, int dir, int cnt) {
  if (!Mp[cnt][dir][x][y]) {
    Mp[cnt][dir][x][y] = true;
    if (!C[x][y]) {
      ans++;
      C[x][y] = true;
    }
    return true;
  }
  return false;
}
void bfs() {
  int la = 1;
  queue<node> Q;
  Q.push(node(200, 200, 1, 1, 0));
  Mp[1][0][200][200] = true;
  C[200][200] = true;
  ans++;
  while (!Q.empty()) {
    int tx, ty;
    node T = Q.front();
    Q.pop();
    if (T.dp != la) {
      la = T.dp;
      memset(Mp, false, sizeof(Mp));
    }
    if (t[T.dp] > T.cnt) {
      int D = T.dir;
      tx = T.x + dir[D][0], ty = T.y + dir[D][1];
      if (judge(tx, ty, T.dir, T.cnt + 1)) {
        Q.push(node(tx, ty, T.cnt + 1, T.dp, T.dir));
      }
    } else if (t[T.dp] == T.cnt && T.dp != n) {
      int dir1 = (T.dir + 1) % 8;
      int dir2 = (T.dir - 1 + 8) % 8;
      tx = T.x + dir[dir1][0], ty = T.y + dir[dir1][1];
      if (judge(tx, ty, dir1, 1)) {
        Q.push(node(tx, ty, 1, T.dp + 1, dir1));
      }
      tx = T.x + dir[dir2][0], ty = T.y + dir[dir2][1];
      if (judge(tx, ty, dir2, 1)) {
        Q.push(node(tx, ty, 1, T.dp + 1, dir2));
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[i]);
  }
  bfs();
  printf("%d\n", ans);
  return 0;
}
