#include <bits/stdc++.h>
using namespace std;
bool vis[302][302][3][3][5][31], sol[302][302];
int ans = 0;
int in(int x, int y, int dx, int dy, int rem, int step) {
  x += 150, y += 150, dx++, dy++;
  if (vis[x][y][dx][dy][rem][step]) return 1;
  vis[x][y][dx][dy][rem][step] = 1;
  if (!sol[x][y]) sol[x][y] = 1, ++ans;
  return 0;
}
int n, arr[50];
void dfs(int x, int y, int dx, int dy, int rem, int step) {
  if (step == n + 1) return;
  if (in(x, y, dx, dy, rem, step)) return;
  if (rem == 0) {
    if (dx == 0) {
      dfs(x - 1, y + dy, -1, dy, arr[step + 1] - 1, step + 1);
      dfs(x + 1, y + dy, +1, dy, arr[step + 1] - 1, step + 1);
      return;
    }
    if (dy == 0) {
      dfs(x + dx, y - 1, dx, -1, arr[step + 1] - 1, step + 1);
      dfs(x + dx, y + 1, dx, +1, arr[step + 1] - 1, step + 1);
    }
    if (dx == 1 && dy == 1) {
      dfs(x, y + 1, 0, 1, arr[step + 1] - 1, step + 1);
      dfs(x + 1, y, 1, 0, arr[step + 1] - 1, step + 1);
    }
    if (dx == -1 && dy == -1) {
      dfs(x, y - 1, 0, -1, arr[step + 1] - 1, step + 1);
      dfs(x - 1, y, -1, 0, arr[step + 1] - 1, step + 1);
    }
    if (dx == -1 && dy == 1) {
      dfs(x, y + 1, 0, 1, arr[step + 1] - 1, step + 1);
      dfs(x - 1, y, -1, 0, arr[step + 1] - 1, step + 1);
    }
    if (dx == 1 && dy == -1) {
      dfs(x, y - 1, 0, -1, arr[step + 1] - 1, step + 1);
      dfs(x + 1, y, 1, 0, arr[step + 1] - 1, step + 1);
    }
    return;
  }
  dfs(x + dx, y + dy, dx, dy, rem - 1, step);
}
int main() {
  cin >> n;
  for (int j = 1; j <= n; j++) cin >> arr[j];
  dfs(0, 0, 0, 1, arr[1] - 1, 1);
  cout << ans << endl;
}
