#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;
unsigned long long powMod(unsigned long long x, unsigned long long n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  unsigned long long tmp = powMod(x, n / 2);
  if (n % 2 == 0) return (tmp * tmp) % MOD;
  return ((unsigned long long)2) * (tmp * tmp) % MOD;
}
int main(void) {
  unsigned long long cnt[65] = {};
  unsigned long long a[300010];
  unsigned long long n;
  cin >> n;
  for (int i = 0; i < int(n); i++) cin >> a[i];
  for (int i = 0; i < int(n); i++) {
    int j = 0;
    unsigned long long b = a[i];
    while (b > 0) {
      cnt[j++] += int(b % 2);
      b >>= 1;
    }
  }
  unsigned long long ans[65] = {};
  for (int i = 0; i < int(n); i++) {
    int j = 0;
    while (j < 60) {
      if (a[i] & 1 == 0) {
        ans[j] += cnt[j];
      } else {
        ans[j] += n - cnt[j];
      }
      a[i] >>= 1;
      j++;
    }
  }
  unsigned long long x = 1;
  unsigned long long r = 0;
  for (int i = 0; i < int(60); i++) {
    r += (ans[i]) * ((x << i) % MOD) % MOD;
  }
  r %= MOD;
  cout << r * powMod(2, MOD - 2) % MOD << endl;
  return 0;
}
