#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
signed main() {
  long long n;
  long long c[61] = {};
  long long a[300000];
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long b = a[i];
    long long cnt = 0;
    while (b) {
      c[cnt] += b % 2;
      cnt++;
      b /= 2;
    }
  }
  long long an = 0;
  cerr << endl;
  for (long long i = 0; i < n; i++) {
    long long ans[61] = {};
    long long b = a[i];
    long long cnt = 0;
    for (long long j = 0; j < 61; j++) {
      ans[cnt] = max(0, c[cnt]) * (!(b % 2));
      cnt++;
      b /= 2;
    }
    long long db = 1;
    for (long long j = 0; j < 61; j++) {
      an += ans[j] * db;
      an %= 1000000007;
      db *= 2;
    }
  }
  cout << an << endl;
}
