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