#include <bits/stdc++.h>
using namespace std;
const double sn = 1e-6;
int n;
int arr[35];
int res;
map<int, map<int, bool>> m;
map<int, map<int, map<int, map<int, map<int, bool>>>>> m2;
void dfs(int t, int dx, int dy, int sx, int sy, int sc) {
  if (m2[dx][dy][sx][sy][sc]) return;
  m2[dx][dy][sx][sy][sc] = true;
  for (int i = 0; i < t; i++) {
    sx += dx;
    sy += dy;
    if (!m[sx][sy]) {
      m[sx][sy] = true;
      res++;
    }
  }
  if (sc < n) {
    sc++;
    if (dx == 0 && dy == 1) {
      dfs(arr[sc - 1], 1, 1, sx, sy, sc);
      dfs(arr[sc - 1], -1, 1, sx, sy, sc);
    } else if (dx == 1 && dy == 1) {
      dfs(arr[sc - 1], 1, 0, sx, sy, sc);
      dfs(arr[sc - 1], 0, 1, sx, sy, sc);
    } else if (dx == 1 && dy == 0) {
      dfs(arr[sc - 1], 1, -1, sx, sy, sc);
      dfs(arr[sc - 1], 1, 1, sx, sy, sc);
    } else if (dx == 1 && dy == -1) {
      dfs(arr[sc - 1], 0, -1, sx, sy, sc);
      dfs(arr[sc - 1], 1, 0, sx, sy, sc);
    } else if (dx == 0 && dy == -1) {
      dfs(arr[sc - 1], -1, -1, sx, sy, sc);
      dfs(arr[sc - 1], 1, -1, sx, sy, sc);
    } else if (dx == -1 && dy == -1) {
      dfs(arr[sc - 1], -1, 0, sx, sy, sc);
      dfs(arr[sc - 1], 0, -1, sx, sy, sc);
    } else if (dx == -1 && dy == 0) {
      dfs(arr[sc - 1], -1, 1, sx, sy, sc);
      dfs(arr[sc - 1], -1, -1, sx, sy, sc);
    } else if (dx == -1 && dy == 1) {
      dfs(arr[sc - 1], 0, 1, sx, sy, sc);
      dfs(arr[sc - 1], -1, 0, sx, sy, sc);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  dfs(arr[0], 0, 1, 0, 0, 1);
  printf("%d\n", res);
  return 0;
}
