#include <bits/stdc++.h>
using namespace std;
int n;
int a[110];
int vis[110];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n / 2; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
  }
  sort(a + 1, a + n / 2 + 1);
  int sum = 0;
  for (int i = 2; i <= n / 2; i++) {
    if (a[i] - a[i - 1] == 1) sum++;
  }
  if (sum != 0)
    printf("%d\n", ++sum);
  else
    printf("%d\n", 0);
  return 0;
}
