#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct __INIT {
  __INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
long long powmod(long long a, long long b) {
  return b ? powmod(a * a % 1000000007, b / 2) * (b % 2 ? a : 1) % 1000000007
           : 1;
}
int main(void) {
  long long N;
  long long div2 = powmod(2, 1000000007 - 2);
  cin >> N;
  long long A[N];
  long long Amod[N];
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A[i];
    Amod[i] = A[i] % 1000000007;
  }
  long long ans = 0;
  long long sum = 0;
  long long minus = 0;
  for (int(i) = 0; (i) < (N); (i)++)
    sum = (sum + Amod[i] * (N - 1)) % 1000000007;
  long long bitcount[60] = {};
  for (int(i) = 0; (i) < (N); (i)++) {
    for (int(j) = 0; (j) < (60); (j)++)
      if (A[i] & 1LL << j) bitcount[j]++;
  }
  for (int(i) = 0; (i) < (60); (i)++) {
    long long bito = (1LL << i) % 1000000007;
    minus = (minus + ((bito * bitcount[i] * (bitcount[i] - 1)) % 1000000007)) %
            1000000007;
  }
  sum -= minus;
  if (sum < 0) sum += 1000000007;
  cout << sum << "\n";
}
