#include <bits/stdc++.h>
using namespace std;
long long n, ans, x, y, h;
long long a[300005];
long long b[105];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long k = 1;
  for (long long i = 0; i < 60; i++) {
    k *= 2;
    b[i] = 0;
  }
  b[60] = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long x = k;
    for (long long j = 60; j >= 0; j--) {
      if (a[i] >= x) {
        a[i] -= x;
        b[j]++;
      }
      x /= 2;
    }
  }
  for (long long i = 60; i >= 0; i--) {
    long long x = 0;
    long long y = 0;
    x += b[i];
    y += (n - b[i]);
    ans += ((x % 1000000007) * (y % 1000000007) * (k % 1000000007));
    k /= 2;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
