#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> zerobit(61);
  vector<int> onebit(61);
  for (int i = 0; i < n; i++) {
    for (long long bit = 0; bit <= 60; bit++) {
      if (a[i] & (1ll << bit))
        onebit[bit]++;
      else
        zerobit[bit]++;
    }
  }
  long long sum = 0;
  for (long long bit = 0; bit <= 60; bit++) {
    sum += (((long long)zerobit[bit] * onebit[bit]) % MOD) * (1ll << bit);
    sum %= MOD;
  }
  cout << sum;
  return 0;
}
