#include <bits/stdc++.h>
using namespace std;
long long int A[31];
bool C[305][305][31][8][6];
bool B[305][305];
int n;
long long int solve(int i, long long int r, int x, int y, int angle) {
  if (C[151 + x][151 + y][i][angle][r]) return 0;
  long long int f = B[151 + x][151 + y] ? 0 : 1;
  B[151 + x][151 + y] = true;
  long long int ans = 0;
  if (i == n && r == 1) {
    return f;
  }
  switch (angle) {
    case 0:
      if (r > 1) {
        ans = f + solve(i, r - 1, x + 1, y, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x + 1, y + 1, 1) +
              solve(i + 1, A[i + 1], x + 1, y - 1, 7);
      break;
    case 1:
      if (r > 1) {
        ans = f + solve(i, r - 1, x + 1, y + 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x, y + 1, 2) +
              solve(i + 1, A[i + 1], x + 1, y, 0);
      break;
    case 2:
      if (r > 1) {
        ans = f + solve(i, r - 1, x, y + 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x - 1, y + 1, 3) +
              solve(i + 1, A[i + 1], x + 1, y + 1, 1);
      break;
    case 3:
      if (r > 1) {
        ans = f + solve(i, r - 1, x - 1, y + 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x - 1, y, 4) +
              solve(i + 1, A[i + 1], x, y + 1, 2);
      break;
    case 4:
      if (r > 1) {
        ans = f + solve(i, r - 1, x - 1, y, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x - 1, y - 1, 5) +
              solve(i + 1, A[i + 1], x - 1, y + 1, 3);
      break;
    case 5:
      if (r > 1) {
        ans = f + solve(i, r - 1, x - 1, y - 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x, y - 1, 6) +
              solve(i + 1, A[i + 1], x - 1, y, 4);
      break;
    case 6:
      if (r > 1) {
        ans = f + solve(i, r - 1, x, y - 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x + 1, y - 1, 7) +
              solve(i + 1, A[i + 1], x - 1, y - 1, 5);
      break;
    case 7:
      if (r > 1) {
        ans = f + solve(i, r - 1, x + 1, y - 1, angle);
      } else
        ans = f + solve(i + 1, A[i + 1], x + 1, y, 0) +
              solve(i + 1, A[i + 1], x, y - 1, 6);
      break;
  }
  C[151 + x][151 + y][i][angle][r] = true;
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  cout << solve(1, A[1], 0, 0, 2) << endl;
}
