title: Number Ordered Pairs Ai Aj 0
signature: class Solution {
  
      public int NumberOrderedPairsAiAj0(List<int> a, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(List<int> a, int n, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(a, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  new List<int>{17, 20, 32, 35, 35, 36, 43, 47, 59, 59, 68, 69, 70, 70, 75, 82, 88, 94, 96, 99}, 17, 
                  54
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-78, -40, 58, -36, 34, -12, -38, 48, -66, 16, 50, -26, -22, 46, -70, -68, -44, -52, -78, -50}, 11, 
                  6
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 23, 
                  506
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{49, 57, 17, 37, 56, 61, 10, 3, 33, 33, 70, 35, 50, 85, 48, 65, 83, 21, 96, 19, 66, 43, 69, 17, 60, 87, 82, 3, 83, 44, 63, 19, 55, 58, 77, 76, 50, 96}, 37, 
                  172
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-94, -88, -86, -80, -80, -72, -64, -60, -58, -58, -58, -50, -44, -32, -8, -8, 0, 6, 8, 10, 14, 14, 18, 28, 34, 34, 46, 54, 56, 56, 56, 64, 66, 66, 70, 82, 84, 88, 96}, 33, 
                  266
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0}, 13, 
                  100
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{1, 3, 10, 11, 13, 14, 15, 17, 20, 25, 26, 26, 27, 29, 32, 36, 36, 36, 42, 46, 47, 49, 51, 54, 54, 55, 60, 66, 67, 68, 68, 68, 72, 77, 78, 79, 83, 84, 92, 98}, 32, 
                  238
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-76, -72, 16, 38, -60, 44, -2, -76, -76, -56, 40, 36, 50, -50, -32, 48, -96, 80, 84, 60, 84, 38, -54, -42, 48, 30, 66, -62, -52, -94, 64, -16, 54, 98}, 28, 
                  116
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 0, 1, 1, 1, 1}, 5, 
                  14
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{63, 82, 22, 84, 11, 62, 18, 43, 57, 25, 4, 27, 62, 46, 55, 16, 1, 9, 10, 73, 36, 80, 95, 87, 47, 64, 27, 25, 70}, 22, 
                  108
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def number_ordered_pairs_ai_aj_0(a, n):
      count = 0
      for i in range(0, n):
          for j in range((i + 1), n):
              if ((a[i] & a[j]) == 0):
                  count += 2
      return count
source_cpp: int number_ordered_pairs_ai_aj_0(vector<int> a, int n) {
    int count = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      for ( int j = i + 1;
      j < n;
      j ++ ) if ( ( a [ i ] & a [ j ] ) == 0 ) count += 2;
    }
    return count;
  }