#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<int>> A(N, vector<int>(60, 0));
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    int d = 0;
    while (a > 0) {
      A[i][d] = a % 2;
      a /= 2;
      d++;
    }
  }
  int cnt[60] = {};
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      cnt[j] += A[i][j];
    }
  }
  int ans[60] = {};
  int cur[60] = {};
  for (int i = 0; i < N - 1; i++) {
    for (int j = 0; j < 60; j++) {
      cur[j] += A[i][j];
      if (A[i][j] == 0) {
        ans[j] += cnt[j] - cur[j];
      } else {
        ans[j] += (N - 1 - i) - (cnt[j] - cur[j]);
      }
    }
  }
  long long answer = 0;
  for (int i = 0; i < 60; i++) {
    answer += ((long long)(pow(2, i) * ans[i]) % 1000000007);
  }
  cout << answer % 1000000007 << endl;
  return 0;
}
