#include <bits/stdc++.h>
using namespace std;
long long ch[62][2];
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    ch[i][0] = n;
  }
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    long long now = 0;
    while (x != 0) {
      if (x % 2 == 1) {
        ch[now][1]++;
        ch[now][0]--;
      }
      now++;
      x /= 2;
    }
  }
  long long now = 1;
  long long ans = 0;
  for (long long i = 0; i < 62; i++) {
    ans += now * ch[i][0] * ch[i][1];
    ans %= 1000000007;
    now *= 2;
    now %= 1000000007;
  }
  cout << ans;
  return 0;
}
