#include <bits/stdc++.h>
using namespace std;
int n, ans, now;
int main() {
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    for (int j = -1; j <= 1; j++) {
      if (now < arr[i] + j) {
        ans++;
        now = arr[i] + j;
        break;
      }
    }
  }
  cout << ans << endl;
}
