#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
int main() {
  long long N, x, y, ans = 0, base = 1;
  cin >> N;
  vector<long long> vec(N);
  for (long long i = (0); i < (N); i++) {
    cin >> vec[i];
  }
  for (long long bit = (0); bit < (60); bit++) {
    x = y = 0;
    for (long long i = (0); i < (N); i++) {
      if (vec[i] & (long long)1 << bit) {
        x++;
      } else {
        y++;
      }
    }
    ans = (ans + (x * y * base) % MOD) % MOD;
    base *= 2;
  }
  cout << (ans) << endl;
}
