#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
unsigned long long power(unsigned long long x, unsigned long long y) {
  if (y == 0)
    return 1;
  else {
    if (y % 2 == 0)
      return power(x * x, y / 2);
    else
      return x * power(x * x, (y - 1) / 2);
  }
}
unsigned long long gcd(unsigned long long x, unsigned long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  int i;
  for (int i = 0; i <= n - 1; i++) cin >> v[i];
  sort(v.begin(), v.end());
  set<int> s;
  for (int i = 0; i <= n - 1; i++) {
    if (s.find(v[i] - 1) == s.end() && v[i] - 1 != 0)
      s.insert(v[i] - 1);
    else if (s.find(v[i]) == s.end())
      s.insert(v[i]);
    else
      s.insert(v[i] + 1);
  }
  cout << s.size() << endl;
}
