#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> num_1(62, 0);
  vector<long long> num_0(62, 0);
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A[i];
    for (int(b) = 0; (b) < (62); (b)++) {
      if ((A[i] >> b) % 2 == 1)
        num_1[b]++;
      else
        num_0[b]++;
    }
  }
  long long ans = 0;
  long long pow2 = 1;
  for (int(i) = 0; (i) < (62); (i)++) {
    ans += pow2 * num_1[i] * num_0[i];
    pow2 *= 2;
    pow2 %= 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
