#include <bits/stdc++.h>
using namespace std;
long long INF = 1e9 + 7;
long long mod = 1e9 + 7;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long cnt = 1;
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long X = 0, Y = 0;
    for (long long j = 0; j < N; j++) {
      if (1 & (A[j] >> i)) {
        X++;
      } else {
        Y++;
      }
    }
    ans += X * Y % INF * cnt % INF;
    cnt = cnt * 2 % INF;
  }
  cout << ans << endl;
}
