#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (int i = 0; i < N; i++) {
    long value;
    cin >> value;
    bitset<60> data(value);
    A.at(i) = data;
  }
  vector<long> num(60);
  for (int i = 0; i < 60; i++) {
    int tmp = 0;
    for (int j = 0; j < N; j++) {
      if (A.at(j).test(i)) tmp++;
    }
    num.at(i) = tmp;
  }
  long long ans;
  for (int i = 0; i < 60; i++) {
    long long mul1 = num.at(i) * (N - num.at(i)) % MOD;
    long long mul2 = (long long)(1LL << i) % MOD;
    ans += mul1 * mul2;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
