#include <bits/stdc++.h>
const int INF = 100100100;
const long long MOD = 1000000007;
using namespace std;
int main() {
  int N;
  unsigned long long a[300001];
  unsigned long long res = 0;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  unsigned long long digit = 1;
  for (int j = 0; j <= 60; j++) {
    int x = 0;
    for (int i = 0; i < N; i++) {
      if (a[i] >> j & 1) x++;
    }
    res = (res + ((x * (N - x) % MOD) * digit % MOD)) % MOD;
    digit = 2 * digit % MOD;
  }
  cout << res << endl;
}
