#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000003 int main(){ int N; cin>>N; vector A(N); rep(i,N){ cin>>A[i]; } sort(A.begin(),A.end()); map mp; rep(i,A.size()){ mp[A[i]] ++; if(mp.count(A[i]-1)){ mp[A[i]+1] += mp[A[i]-1]; } } long long ans = 0LL; for(auto a:mp){ ans += a.second; } cout<