#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long MOD = 1000000007;
  int N;
  cin >> N;
  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    long long x;
    cin >> x;
    bitset<60> a(x);
    A[i] = a.to_string();
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long count[2] = {0, 0};
    for (int j = 0; j < N; j++) {
      if (A[j][i] == '0')
        count[0]++;
      else
        count[1]++;
    }
    ans += (count[0] * count[1] * ((long long)pow(2, (59 - i)) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
