#include <bits/stdc++.h>
using namespace std;
int gcdEx(int a, int b, int *x, int *y) {
  if (!a) {
    *x = 0;
    *y = 1;
    return b;
  }
  int x1, y1, gcd = gcdEx(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
int modI(int b, int m) {
  int x, y;
  gcdEx(b, m, &x, &y);
  return (x % m + m) % m;
}
long long modP(long long x, long long y) {
  long long r = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) {
      r = (r * x) % 1000000007;
    }
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return r;
}
int main() {
  freopen("input.txt", "r", stdin);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> arr(n);
    long long u, v;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    long long sum = 0;
    for (long long i = 0; i < 60; i++) {
      long long zc = 0, oc = 0;
      long long idsum = 0;
      for (long long j = 0; j < n; j++) {
        if (arr[j] % 2 == 0)
          zc++;
        else
          oc++;
        arr[j] /= 2;
      }
      idsum = (int)((((long long)((int)((((long long)(oc % 1000000007)) *
                                         ((long long)(zc % 1000000007))) %
                                        1000000007) %
                                  1000000007)) *
                     ((long long)((1 << i) % 1000000007))) %
                    1000000007);
      sum = (((sum % 1000000007) + (idsum % 1000000007)) % 1000000007);
    }
    sum = sum % 1000000007;
    cout << sum;
  }
  return 0;
}
