fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<iomanip>
  4. #include<cmath>
  5. #include<algorithm>
  6. #include<vector>
  7. #include<stack>
  8. #include<queue>
  9. #include<map>
  10. #include<deque>
  11. #include<set>
  12. #include<bitset>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <functional>
  16. typedef unsigned long long ull;
  17. typedef long long ll;
  18. typedef long double ld;
  19. //#define all(v) v.begin(),v.end()
  20. #define sz(s)(int)(s.size())
  21. #define PI 3.14159265
  22. #define ebs 1e-8
  23. using namespace std;
  24. void fast()
  25. {
  26. std::ios_base::sync_with_stdio(0);
  27. cin.tie(NULL);
  28. cout.tie(NULL);
  29.  
  30. }
  31. //void file() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); }
  32. ll frq[100000];
  33. int main()
  34. {
  35. //file();
  36. fast();
  37. ll arr[4];
  38. ll a = 0, b = 0, c = 0, d = 0;
  39. for (int i = 0; i < 4; i++)
  40. {
  41. cin >> arr[i];
  42. if (arr[i] == arr[0])
  43. a++;
  44. else if (arr[i] == arr[1])
  45. b++;
  46. else if (arr[i] == arr[2])
  47. c++;
  48. else if (arr[i] == arr[3])
  49. d++;
  50. }
  51. ll z = max(a, max(b, max(c, d)));
  52. //cout << a << "\n" << b << "\n" << c << "\n" << d << "\n";
  53. if (z > 1)
  54. {
  55. ll cnt = 0;
  56. if (z == a)
  57. cnt++;
  58. if (z == b)
  59. cnt++;
  60. if (z == c)
  61. cnt++;
  62. if (z == d)
  63. cnt++;
  64. //cout << cnt << "\n";
  65. cout << cnt*(z - 1) << "\n";
  66. }
  67. else
  68. cout << z - 1 << "\n";
  69. return 0;
  70. }
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
0