#include <bits/stdc++.h>
using namespace std;
long long const MOD = 1e9 + 7;
long long const MaxSize = 3e5 + 5;
int N;
long long a[MaxSize];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (long long i = int(0); i < int(N); i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long shift = int(0); shift < int(60); shift++) {
    long long one = 1L;
    long long base = one << shift;
    long long n1 = 0;
    for (long long i = int(0); i < int(N); i++) {
      if (a[i] & base) n1 += 1;
    }
    long long part = n1 * (N - n1);
    part %= MOD;
    part *= base;
    part %= MOD;
    ans += part;
    ans %= MOD;
  }
  cout << ans;
  return 0;
}
