#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
int main() {
  long long N, ans = 0;
  vector<long long> A;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    A.emplace_back(a);
  }
  long long max = *max_element(A.begin(), A.end());
  for (long long i = 0; i < 60; i++) {
    long long x = 0, y = 0;
    long long binary = ((long long)pow(2, i));
    if (binary > max) {
      break;
    }
    for (long long j = 0; j < N; j++) {
      if ((A[j] & binary) == 0) {
        x++;
      }
    }
    ans += x * (N - x) * binary;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
