fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. vector<int> a(n);
  8. for(int i = 0; i < n; i++) cin >> a[i];
  9.  
  10. int count = 0;
  11. for(int i = 0; i < n; i++){
  12. for(int j = 0; j < n; j++){
  13. for(int k = 0; k < n; k++){
  14. if((a[i] | a[j] | a[k]) == 7)
  15. count++;
  16. }
  17. }
  18. }
  19. cout << count;
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5304KB
stdin
3
1 4 2
stdout
6