#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int n;
long long A[300005], ans = 0, maxA = -1;
long long GetDigit(long long num) {
  long long digit = 0;
  while (num != 0) {
    num /= 2;
    digit++;
  }
  return digit;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if (maxA < A[i]) {
      maxA = A[i];
    }
  }
  int dig = GetDigit(maxA);
  for (int i = 0; i <= dig; i++) {
    int zero = 0, one = 0;
    for (int j = 0; j < n; j++) {
      if ((A[j] >> i) & 1) {
        one++;
      } else {
        zero++;
      }
    }
    long long num = one * zero;
    for (int k = 0; k < i; k++) {
      num = (num * 2) % MOD;
    }
    ans += num;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
