#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long N;
  vector<unsigned long long> count(60);
  cin >> N;
  unsigned long long A;
  for (unsigned long long(i) = (0); (i) < (N); (i)++) {
    cin >> A;
    for (unsigned long long(j) = (0); (j) < (60); (j)++) {
      count[j] += (A >> j & 1);
    }
  }
  unsigned long long sum = 0;
  for (unsigned long long(i) = (0); (i) < (60); (i)++) {
    sum += count[i] % 1000000007 * (N - count[i]) % 1000000007 * (1LL << i) %
           1000000007;
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
