#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <typename T>
T pow(T x, T y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return pow(x, y / 2) * pow(x, y / 2);
  else
    return x * pow(x, y - 1);
}
int main() {
  long long N;
  cin >> N;
  long long ans = 0;
  vector<vector<long long>> now_01sum(60, vector<long long>(2, 0));
  for (long long i = 0; i < N; i++) {
    long long A;
    cin >> A;
    for (long long j = 0; j < 60; j++) {
      if (A % 2 == 1) {
        ans += (pow((long long)2, j) % MOD) * (now_01sum[j][0] % MOD);
        ans %= MOD;
        now_01sum[j][1]++;
      } else {
        ans += (pow((long long)2, j) % MOD) * (now_01sum[j][1] % MOD);
        ans %= MOD;
        now_01sum[j][0]++;
      }
      A /= 2;
    }
  }
  cout << ans << endl;
}
