#include <bits/stdc++.h>
using namespace std;
int N;
long long V[300005];
int main() {
  long long maxVal = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> V[i];
    maxVal = max(V[i], maxVal);
  }
  long long sum = 0;
  long long offset = 0;
  while (maxVal > 0) {
    int zero = 0;
    int one = 0;
    for (int i = 0; i < N; i++) {
      long long x = V[i];
      if ((x >> offset) & 1) {
        one++;
      } else {
        zero++;
      }
    }
    sum += zero * one * (1 << offset);
    sum %= 1000000007l;
    offset++;
    maxVal = maxVal >> 1;
  }
  cout << sum;
}
