#include <bits/stdc++.h>
using namespace std;
const int N = 400, D = 8;
int vis[N][N];
int T[30];
bool used[N][N][D][6][31];
struct obj {
  int x, y, d, t, i;
  void move() {
    if (d == 0 || d == 1 || d == 7) x++;
    if (d == 5 || d == 4 || d == 3) x--;
    if (d == 1 || d == 2 || d == 3) y++;
    if (d == 5 || d == 6 || d == 7) y--;
    t--;
  }
  obj splitL() { return {x, y, (d + 1) % D, T[i + 1], i + 1}; }
  obj splitR() { return {x, y, (d + D - 1) % D, T[i + 1], i + 1}; }
  bool check(bool set = false) {
    if (set) used[x][y][d][t][i] = true;
    return used[x][y][d][t][i];
  }
};
queue<obj> q;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> T[i];
  q.push({N / 2, N / 2, 0, T[0] - 1, 0});
  while (not q.empty()) {
    auto curr = q.front();
    q.pop();
    if (curr.check()) continue;
    curr.check(true);
    vis[curr.x][curr.y] = 1;
    if (curr.t == 0) {
      if (curr.i == n) continue;
      q.push(curr.splitL());
      q.push(curr.splitR());
      continue;
    }
    curr.move();
    q.push(curr);
  }
  int ans = 0;
  for (int x = 0; x < N; x++) {
    for (int y = 0; y < N; y++) {
      ans += vis[x][y];
    }
  }
  cout << ans << '\n';
  return 0;
}
