#include<iostream> #include<stdio.h> #include<unordered_map> using namespace std; int main() { int n ; cin >> n; long long count = 0; unordered_map<long long, int>res; while(n) { long long a; cin >> a; if(res[a+1]) { res[a+1] = 0; res[a] =1; } else { res[a] = 1; count++; } n--; } cout << count; return 0; }
全部评论
(0) 回帖