#include <bits/stdc++.h>
using namespace std;
const int UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3;
const int UPLEFT = 4, UPRIGHT = 5, DOWNLEFT = 6, DOWNRIGHT = 7;
int dx[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dy[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int MAX = 5 * 30 + 5;
bool marked[2 * MAX][2 * MAX][8][32][6];
map<pair<int, int>, bool> mp;
int t[100];
pair<int, int> rot(int dir) {
  if (dir == UP) return make_pair(UPLEFT, UPRIGHT);
  if (dir == DOWN) return make_pair(DOWNLEFT, DOWNRIGHT);
  if (dir == LEFT) return make_pair(UPLEFT, DOWNLEFT);
  if (dir == RIGHT) return make_pair(UPRIGHT, DOWNRIGHT);
  if (dir == UPLEFT) return make_pair(UP, LEFT);
  if (dir == UPRIGHT) return make_pair(UP, RIGHT);
  if (dir == DOWNLEFT) return make_pair(DOWN, LEFT);
  if (dir == DOWNRIGHT) return make_pair(DOWN, RIGHT);
}
struct node {
  int x, y, dir;
  int lev, far;
  node(int _x, int _y, int _dir, int _lev, int _far) {
    x = _x, y = _y, dir = _dir, lev = _lev, far = _far;
  }
};
queue<node> Q;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  int ans = 0;
  Q.push(node(MAX, MAX, UP, 1, 1));
  marked[MAX][MAX][UP][1][1] = true;
  mp[pair<int, int>(MAX, MAX)] = true;
  ans++;
  while (!Q.empty()) {
    node v = Q.front();
    Q.pop();
    if (!mp[pair<int, int>(v.x, v.y)]) {
      mp[pair<int, int>(v.x, v.y)] = true;
      ans++;
    }
    int lev = v.lev;
    int far = v.far;
    int x2 = v.x, y2 = v.y;
    if (lev == n + 1) continue;
    if (far != t[lev]) {
      x2 += dx[v.dir], y2 += dy[v.dir];
      if (marked[x2][y2][v.dir][lev][far + 1]) continue;
      marked[x2][y2][v.dir][lev][far + 1] = true;
      Q.push(node(x2, y2, v.dir, lev, far + 1));
    } else {
      pair<int, int> dirs = rot(v.dir);
      if (!marked[v.x][v.y][dirs.first][lev + 1][0]) {
        marked[v.x][v.y][dirs.first][lev + 1][0] = true;
        Q.push(node(v.x, v.y, dirs.first, lev + 1, 0));
      }
      if (!marked[v.x][v.y][dirs.second][lev + 1][0]) {
        marked[v.x][v.y][dirs.second][lev + 1][0] = true;
        Q.push(node(v.x, v.y, dirs.second, lev + 1, 0));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
