#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int count_bit(long long x) {
  int ans = 0;
  while (x > 0) {
    x = x / 2;
    ans++;
  }
  return ans;
}
long long ruizyou2(int x) {
  long long p = 1;
  for (int i = 0; i < x; i++) {
    p = 2 * p;
  }
  return p;
}
int main() {
  int n;
  long long a[300005];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  sort(a, a + n);
  int c = count_bit(a[n - 1]);
  for (int i = 0; i <= c; i++) {
    long long b[300005] = {0};
    int box0 = 0;
    int box1 = 0;
    for (int j = 0; j < n; j++) {
      b[j] = a[j] >> i;
      if (b[j] % 2 == 1) {
        box1++;
      } else {
        box0++;
      }
    }
    ans += box1 * box0 * ruizyou2(i) % MOD;
  }
  cout << (MOD + ans) % MOD << endl;
}
