fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n; cin>> n;
  6. int f = 0;
  7. int mp[5] = {};
  8. for(int i=0;i<n;i++) {
  9. int t;
  10. cin>> t;
  11. t %= 5;
  12. f += mp[(5-t)%5];
  13. mp[t]++;
  14. }
  15. cout << f;
  16. }
Success #stdin #stdout 0s 5316KB
stdin
6
2 2 5 5 3 3
stdout
5