#include <bits/stdc++.h>
using namespace std;
long long int toDecimal(string binary) {
  long long int decimal = 0;
  for (int i = binary.size() - 1; i >= 0; i--) {
    if (binary[i] == '0') {
      continue;
    } else {
      decimal += pow(2, binary.size() - 1 - i);
    }
  }
  return decimal;
}
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N);
  const int b = 1e9 + 7;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long int total = 0;
  for (int i = 0; i < N - 1; i++) {
    bitset<64> value1(A[i]);
    for (int j = i + 1; j < N; j++) {
      bitset<64> value2(A[j]);
      value2 = value1 ^ value2;
      total += toDecimal(value2.to_string());
      if (total > b) {
        total = total % b;
      }
    }
  }
  cout << total % b << endl;
}
