#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
const long long mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> a[i];
  long long sum = 0;
  for (long long i = 0; i < (long long)(60); i++) {
    long long zero = 0, one = 0;
    for (long long j = 0; j < (long long)(n); j++) {
      if (a[j] >> i & 1)
        one++;
      else
        zero++;
    }
    sum += (one * zero % mod) * ((1 << i) % mod) % mod;
  }
  cout << sum << endl;
  return 0;
}
