#include <bits/stdc++.h>
using namespace std;
int n, t[42];
uint8_t was[1024][1024][32];
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
set<pair<int, int>> v;
void go(int x, int y, int lev, int dir) {
  if (was[x][y][lev] & (1 << dir)) return;
  was[x][y][lev] |= 1 << dir;
  v.insert({x, y});
  for (int i = 1; i < t[lev]; i++) v.insert({x += dx[dir], y += dy[dir]});
  if (lev < n - 1) {
    int dl = (dir + 7) % 8;
    int dr = (dir + 1) % 8;
    go(x + dx[dl], y + dy[dl], lev + 1, dl);
    go(x + dx[dr], y + dy[dr], lev + 1, dr);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i];
  go(500, 500, 0, 0);
  cout << v.size() << endl;
}
