#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  int i;
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  reverse(arr.begin(), arr.end());
  vector<int> boxers;
  long long lst = 100000000000;
  for (i = 0; i < n; ++i) {
    if (arr[i] + 1 < lst) {
      boxers.push_back(arr[i] + 1);
      lst = arr[i] + 1;
    } else if (arr[i] < lst) {
      boxers.push_back(arr[i]);
      lst = arr[i];
    } else if (arr[i] - 1 < lst && arr[i] - 1 > 0) {
      boxers.push_back(arr[i] - 1);
      lst = arr[i] - 1;
    }
  }
  cout << boxers.size();
}
