Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <ctype.h>
- #include <time.h>
- #pragma warning(disable:4996)
- typedef long long LL;
- typedef unsigned long long ULL;
- int arr[114514] = { 0 };
- int cmpi32(const void *p, const void *q){
- int a = *(int *)p, b = *(int *)q;
- if(a > b)return 1;
- else if(a < b)return -1;
- else return 0;
- }
- int main(){
- #ifdef _DEBUG
- FILE *fp = freopen("../../../input.txt", "r", stdin);
- //FILE *fp2 = freopen("../../../o5.txt", "w", stdout);
- #endif // _DEBUG
- int n, i;
- scanf("%d", &n);
- for(i = 1; i <= n; i++){
- scanf("%d", arr + i);
- }
- if(n == 1){
- puts("1");
- return 1;
- }
- qsort(arr + 1, n, sizeof(int), cmpi32);
- int cnt = 0, ans = 0;
- for(i = 1; i <= n + 1; i++){
- if(arr[i] != arr[i - 1]){
- ans += (cnt & 1);
- cnt = 1;
- }
- else{
- cnt += 1;
- }
- }
- printf("%d\n", ans);
- #ifdef _DEBUG
- freopen("CON", "r", stdin);
- //freopen("CON", "w", stdout);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment