#include <bits/stdc++.h>
using namespace std;
int N;
int main() {
  cin >> N;
  unsigned long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  unsigned long long ans = 0;
  for (int i = 0; i < 60; i++) {
    int zero = 0;
    int one = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] % 2 == 0) {
        zero++;
      } else {
        one++;
      }
      A[j] /= 2;
    }
    unsigned long long b = 1;
    ans += zero * one * (b << i) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
