#include <bits/stdc++.h>
using namespace std;
long long power(long long x, int n) {
  long long res = 1;
  while (n > 0) {
    if (n % 2) res = res * x % (1000000000 + 7);
    x = x * x % (1000000000 + 7);
    n /= 2;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<int>> a(N + 1, vector<int>(60));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      a[i + 1][j] = a[i][j] + (A[i] >> j & 1);
    }
  }
  vector<int> b(60);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      int nb = a[N][j] - a[i + 1][j];
      if (A[i] >> j & 1) {
        b[j] += N - 1 - i - nb;
      } else {
        b[j] += nb;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    ans += power(2, i) * b[i] % (1000000000 + 7);
    ans %= (1000000000 + 7);
  }
  cout << ans << endl;
}
