#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int N=1e6 ;
int n , a ,ans=0 ;
int main()
{
cin>>n;
multiset<ll>s;
for(int i=0;i<n;i++)
{
cin >> a ;
if(s.find(a)==s.end())ans++,s.insert(a-1);
else
{
s.erase(s.find(a)) ;
s.insert(a-1) ;
}
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
312 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
333 ms |
3932 KB |
Output is correct |
6 |
Correct |
383 ms |
3960 KB |
Output is correct |
7 |
Correct |
324 ms |
3224 KB |
Output is correct |
8 |
Correct |
313 ms |
3336 KB |
Output is correct |
9 |
Correct |
333 ms |
3680 KB |
Output is correct |
10 |
Correct |
332 ms |
3460 KB |
Output is correct |