forked from 21171-somesh/CodeforcesSolutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1007A.cpp
More file actions
50 lines (45 loc) · 775 Bytes
/
1007A.cpp
File metadata and controls
50 lines (45 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
#define flp(i ,a ,b) for(int i = a ; i<b ; i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define blp(i, a , b) for(int i = a ; i<=b ; i--)
long long binpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
int main()
{ int n ;
cin >> n ;
vector <int> v ;
flp(i, 0, n)
{
int x ;
cin >> x ;
v.push_back(x);
}
sort(v.begin(), v.end());
int ans =0 ;
int j = 1 ;
for(int i = 0 ; i<n && j<n ; )
{
if(v[i]<v[j])
{
i++;
j++;
ans++;
}
else
{
j++;
}
}
cout << ans ;
}