#include <bits/stdc++.h>
using namespace std;
inline int ctoi(char c) { return (int)(c - '0'); }
const static int N = 61;
const static long long MOD = 1000000007;
long long one[N] = {};
long long zero[N] = {};
int main() {
  int n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0, end = (int)(n); i < end; i++) {
    cin >> arr[i];
  }
  for (int i = 0, end = (int)(n); i < end; i++) {
    long long target = arr[i];
    int count = 0;
    while (count < N) {
      int a = target % 2;
      if (a) {
        ++one[count];
      } else {
        ++zero[count];
      }
      ++count;
      target /= 2;
    }
  }
  long long base = 1;
  long long ans = 0;
  for (int i = 0, end = (int)(N); i < end; i++) {
    ans += (base * zero[i] * one[i]) % MOD;
    ans %= MOD;
    base *= 2;
  }
  cout << ans << endl;
  return 0;
}
