#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000;
int main() {
  int n;
  unsigned long long int mod = 1e9 + 7;
  unsigned long long int ans = 0;
  unsigned long long int a[maxn];
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  unsigned long long int b = 1;
  for (long long int i = 0; i < 61; i++) {
    b = b * 2;
    long long int A = 0, B = 0;
    for (long long int j = 0; j < n; j++) {
      long long int t = a[j] % b;
      if (a[j] >= b / 2 && b / 2 <= t && t <= b - 1)
        A++;
      else
        B++;
    }
    long long int add = ((b / 2) * A % mod * B % mod) % mod;
    ans = (ans + add) % mod;
    if (ans < 0) ans += mod;
  }
  cout << ans << endl;
  return 0;
}
