#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int *input = new int[n];
  for (int i = 0; i < n; i++) cin >> input[i];
  sort(input, input + n);
  int over = input[n - 1] + 1;
  int ans = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (input[i] + 1 < over) {
      over = input[i] + 1;
      ans++;
    } else if (input[i] < over) {
      over = input[i];
      ans++;
    } else if (input[i] - 1 > 0 && input[i] - 1 < over) {
      over = input[i] - 1;
      ans++;
    }
  }
  cout << ans << endl;
}
