#include <bits/stdc++.h>
using namespace std;
long long sum = 0, a[3001], beki[61];
int A[300001][60] = {0}, B[300001][60] = {0};
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    for (int j = 0; j < 60; j++) {
      A[i][j] = A[i - 1][j] + ((a[i] >> j) & 1);
      B[i][j] = B[i - 1][j] + 1 - ((a[i] >> j) & 1);
    }
  }
  beki[0] = 1;
  for (int i = 1; i <= 60; i++) {
    beki[i] = beki[i - 1] * 2;
    beki[i] %= 1000000007;
  }
  for (int i = 1; i <= N - 1; i++) {
    for (int j = 0; j < 60; j++) {
      if (((a[i] >> j) & 1) == 0)
        sum += ((A[N][j] - A[i][j]) * beki[j]) % 1000000007;
      else if (((a[i] >> j) & 1) > 0)
        sum += ((B[N][j] - B[i][j]) * beki[j]) % 1000000007;
      sum %= 1000000007;
    }
  }
  cout << sum;
  return 0;
}
