#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int m = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] - 1 > m) {
      m = a[i] - 1;
      ++ans;
    } else if (a[i] > m) {
      m = a[i];
      ++ans;
    } else if (a[i] + 1 > m) {
      m = a[i] + 1;
      ++ans;
    }
  }
  cout << ans << "\n";
  return 0;
}
