#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long f(long long x) {
  long long res = 0;
  while (x % 2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}
long long power(long long a, long long n, long long p) {
  long long res = 1;
  while (n) {
    if (n % 2) {
      res = (res * a) % p;
      n--;
    } else {
      a = a * a % p;
      n /= 2;
    }
    return res;
  }
}
long long arr[300001];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long one[64];
  long long zero[64];
  for (long long i = 0; i < n; i++) {
    long long tmp = arr[i];
    long long k = 0;
    while (tmp) {
      if (tmp & 1) {
        one[k]++;
      } else {
        zero[k]++;
      }
      tmp /= 2;
      k++;
    }
    for (long long j = k; j <= 63; j++) {
      zero[j]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 64; i++) {
    if (one[i] != 0 && zero[i] != 0) {
      long long s = (one[i] % 1000000007 * zero[i] % 1000000007) % 1000000007;
      s = (s % 1000000007 * (power(2, i, 1000000007) % 1000000007)) %
          1000000007;
      ans = (ans % 1000000007 + s % 1000000007) % 1000000007;
    }
  }
  cout << ans << endl;
}
