#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long int;
int main() {
  int n;
  cin >> n;
  ll a[n + 1];
  bitset<64> bita;
  bitset<64> bitb;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll count = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      bita = a[i];
      bitb = a[j];
      count += (bita ^ bitb).to_ullong();
      if (count > 1000000007) {
        count = count % 1000000007;
      }
    }
  }
  cout << count;
  return 0;
}
